[Mono-list] typeof(string)
Dan Lewis
dihlewis@yahoo.co.uk
Fri, 15 Mar 2002 16:43:28 +0000 (GMT)
--- Gaurav Vaish <gvaish@iitk.ac.in> wrote:
> : Shouldn't it be:
> :
> : if (destinationType == typeof (string)) { ... }
> :
> : typeof returns an object of class Type, which what you're checking equality
> : against.
>
> Thanks Buddy. Lol.
> I guess, I ought to change my name now.
No problem ;-) By the way, if you really want 'is' operator semantics, you'd
probably best write the following:
if (typeof (string).IsAssignableFrom (destinationType)) { ... }
But then again I haven't seen too many classes derived from string...
Dan.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com