title: How to check if an object its *exactly* a class, not a derived one?
body: <p>There is any way to determine if an object is <em>exactly</em> a class and not a derived one of that?</p>
  
  <p>For instance:</p>
  
  <pre><code>class A : X { }
  
  class B : A { }
  </code></pre>
  
  <p>I can do something like this:</p>
  
  <pre><code>bool isExactlyA(X obj)
  {
     return (obj is A) &amp;&amp; !(obj is B);
  } 
  </code></pre>
  
  <p>Of course if there are more derived classes of <code>A</code> I'd have to add <em>and</em> conditions.</p>