instanceOf

  • Thread starter Thread starter rua17
  • Start date Start date
R

rua17

Can anyone tell me what's the command in c#
that is equivalent to the instanceOf in java?

thanks
 
Check GetType and TypeOf

x instanceOf y

will be

x.GetType()==y.GetType();
or
TypeOf(x)==TypeOf(y);

HTH
Alex
 
AlexS said:
Check GetType and TypeOf

x instanceOf y

will be

x.GetType()==y.GetType();
or
TypeOf(x)==TypeOf(y);

No it's not. For instance:

FileStream fs = new FileStream (...);

(fs instanceof Stream) should be true, but that won't work with the
above.

The equivalent C# operator to Java's "instanceof" operator is "is".
 
Back
Top