title: Find all parent types (both base classes and interfaces)
body: <p>I want to be able to find all parent types (base classes and interfaces) for a specific type.</p>
  
  <p>EG if i have </p>
  
  <pre><code>class A : B, C { }
  class B : D { }
  interface C : E { }
  class D { }
  interface E { }
  </code></pre>
  
  <p>i want to see that A <em>is</em> B C D and E and Object</p>
  
  <p>Whats the best way to do this? is there a reflection method to do this or do i need to make myself something. </p>
  
  <p>====EDIT====</p>
  
  <p>So something like this?</p>
  
  <pre><code>public static IEnumerable&lt;Type&gt; ParentTypes(this Type type)
      {
          foreach (Type i in type.GetInterfaces())
          {
              yield return i;
              foreach (Type t in i.ParentTypes())
              {
                  yield return t;
              }
          }
  
          if (type.BaseType != null)
          {
              yield return type.BaseType;
              foreach (Type b in type.BaseType.ParentTypes())
              {
                  yield return b;
              }
          }
      }
  </code></pre>
  
  <p>I was kinda hoping i didn't have to do it myself but oh well.</p>