title: Find if a class derives from another class which is generic in .NET?
body: <p>I have a class like:</p>
  
  <pre><code>class A&lt;T&gt;
  {
  
  }
  </code></pre>
  
  <p>I have another class that derives from above class like:</p>
  
  <pre><code>class B : A&lt;X&gt;
  {
  
  }
  </code></pre>
  
  <p>Above X is another class.</p>
  
  <p>Now I can have many classes like B, and in those classes the generic parameter could be some other class.</p>
  
  <p>How do I figure out if any instance of class like B is deriving from class A ?</p>
  
  <p>I tried:</p>
  
  <pre><code>if objB.GetType() is typeof(A&lt;object&gt;) //didn't work, gave false
  
  if objB.GetType() == typeof(A&lt;object&gt;) //didn't work, gave false
  
  if typeof(A&lt;object&gt;).IsAssignableFrom(obj.GetType()) //didn't work, gave false
  </code></pre>
  
  <p>How to do it ?</p>