Consider the following code:
public class A
{
}
public class B : A
{
}
public class C : B
{
}
class D
{
public static bool IsDescendantOf(this System.Type thisType, System.Type thatType)
{
/// ???
}
void Main()
{
A cValue = new C();
C.GetType().IsDescendantOf(cValue.GetType());
}
}
What is the best way to implement IsDescendantOf?
Type.IsSubclassOf() Determines whether the class represented by the current Type derives from the class represented by the specified Type.