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
As an alternative to the (c is B) check, you can also do the following:
(c is B)
var maybeB = c as B; if (maybeB != null) { // make use of maybeB }
This is preferred in some cases since in order to make use of c as a B when using is, you would have to cast anyway.
c
B
is