Comparing object types

  • Thread starter Thread starter HelgeS
  • Start date Start date
H

HelgeS

I want to determin if objectA is of the same type as
objectB, or is inherrited from the same type.

I hav tried something like
Type objectAType = objectA.GetType();
if(objectB is objectAType)
....

That does not work, because the "is" statement requires a
class name and not a object of type "Type".

Any suggestions?

HelgeS
 
Hi.

I think you can use the method Type.IsInstanceOfType(). If you look at the
..NET SDK documentation on that method, you can find an example that shows a
good example of its use.

Have a nice day
GV
 
Back
Top