I want to compare the type of an object with a type to see if they match. I don't have an object, just an object type.
I can do type1 == type2 and get general equality
I can have a recursive loop where I repeat the above step for type1.BaseType until BaseType is zero.
I can do type1.GetInterface( type2.FullName ) != null to check if type2 is an interface of type1
If I put everything together, I get
if ( type2.IsInterface ) return type1.GetInterface( type2.FullName ) != null; while ( type1 != null ) { if ( type1 == type2 ) return true; type1 = type1.BaseType; } return false;
This is all the is keyword. I canβt find a suitable keyword to connect to the Reflector search to find the function, and google search on βisβ was not really useful
Jdmx
source share