title: C# How to Initialize Generic class with object of type "Type"
body: <p>I recently had this problem.</p>
  
  <pre><code>doSomething(typeof(int));
  doSomething(typeof(MyClassA));
  doSomething(typeof(MyClassB));
  
  public void doSomething(Type _type)
  {
      var myGenObj = new MyGenericClass&lt;_type&gt;();  // Error.  Really I'd want MyGenericClass&lt;int&gt;, MyGenericClass&lt;MyClassA&gt;, etc depending on what's passed in.
      myGenObj.doSomeGenStuff();
      // more stuff...
  
  }
  </code></pre>
  
  <p>I think that this can be done with reflection somehow.. Possibly there's an easier way. I've been somewhat confused on how Type works vs Classes under the covers. Anyways thanks for any help.</p>
  
  <p>Thanks.</p>