Alexander Shirshov <(E-Mail Removed)> wrote:
> Probably I'm missing something, but I don't understand what are you trying
> to achieve.
>
> Since you're passing a value, you already have type information in it and
> you can simply call GetType():
>
> void AddParam(string name, object value)
> {
> if (value.GetType() == typeof(string))
> {
> ...
> }
> ....
> }
Note that that's a lot slower (and less readable, IMO) than:
if (value is string)
or
string valAsString = value as string;
if (valAsString != null)
{
....
}
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too