title: Checking type parameter of a generic method in C#
body: <p>Is it possible to do something like this in C#:</p>
  
  <pre><code>public void DoSomething&lt;T&gt;(T t)  
  {
      if (T is MyClass)
      {
          MyClass mc = (MyClass)t 
          ...
      }
      else if (T is List&lt;MyClass&gt;)
      {
          List&lt;MyClass&gt; lmc = (List&lt;MyClass&gt;)t
          ...
      }
  }
  </code></pre>