I will start by explaining my scenario in code:
public class A { } public class B : A { } public class C : B { } public class D { } public c
You can just use is:
is
if (c is B) // Will be true if (d is B) // Will be false