title: How to determine if a type is in the inheritance hierarchy
body: <p>I need to determine if an object has a specific type in it's inheritance hierarchy, however I can't find a good way of doing it.</p>
  
  <p>An very basic example version of my classes are:</p>
  
  <pre><code>Public Class Domain
  
  End Class
  
  Public Class DerivedOne
      Inherits Domain
  
  End Class
  
  Public Class DerivedTwo
      Inherits DerivedOne
  
  End Class
  
  Public Class DerivedThree
      Inherits Domain
  
  End Class
  </code></pre>
  
  <p>The following does work, however it isn't very elegant in my opinion. Also the more levels of inheritance that get created, the more checks need to be done and it would be easy to forget this piece of code needs to be updated.</p>
  
  <pre><code>If GetType(T) Is GetType(Domain) OrElse _
      GetType(T).BaseType Is GetType(Domain) OrElse _
      GetType(T).BaseType.BaseType Is GetType(Domain) Then
  
  End If
  </code></pre>
  
  <p>Is there a way of getting 'Is type of Domain anywhere in T's inheritance hierarchy'?</p>
  
  <p>(Answers welcome in C# or VB.NET)</p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>One bit of vital information I missed out due to my own idiocy!</p>
  
  <p><strong>T is a Type object (from the class' generic type)</strong> </p>