title: Why doesn't Assembly.GetType() work for generic type instances?
body: <p>I have a generic class in a separate assembly:</p>
  
  <pre><code>class MyGenericClass&lt;T&gt; { }
  </code></pre>
  
  <p>In another assembly, I try to do this:</p>
  
  <pre><code>var assembly = System.Reflection.Assembly.LoadFrom(@"C:\path-to\MyClassLibrary.dll");  
  var t1 = assembly.GetType("MyClassLibrary.MyGenericClass`1");
  var t2 = assembly.GetType("MyClassLibrary.MyGenericClass`1[System.String]");
  </code></pre>
  
  <p>Now, the first call to <code>GetType</code> will return a generic type, but the second will return null.</p>
  
  <p>I tested doing the same with the <code>List&lt;&gt;</code> type:</p>
  
  <pre><code>var assembly2 = System.Reflection.Assembly.LoadFrom(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll");
  var t3 = assembly2.GetType("System.Collections.Generic.List`1[System.String]");
  </code></pre>
  
  <p>Now, this time it works. The type of <code>List&lt;String&gt;</code> is returned. Which leaves me utterly confused.</p>
  
  <p>Why will <code>GetType()</code> not get my type when called with a type parameter <code>[System.String]</code>, when it is able to get the <code>List</code> type when called with the same type parameter?</p>
  
  <p>And is there any other way to get hold of my type? I know I can parse the typename, to extract the parts <code>MyClassLibrary.MyGenericClass'1</code> and <code>[System.String]</code>, and then instantiate the generic type based on these types, but I would probably mess something up along the way, so I was looking for a simpler, solid, built-in way to get this type object.</p>