title: c# get the name of the generic type parameter in generic class
body: <p>I'm trying to get the type parameter's name (<code>ClassName&lt;TypeParameterName&gt;</code>) of geneic class from the class type.</p>
  
  <p>for example something like this:</p>
  
  <pre><code>class MyClass&lt;Type1&gt;
  {
      public Type data;
  }
  static void Main()
  {
      Console.WriteLine(typeof(MyClass&lt;int&gt;).GetTypeParameterName());
      //prints: Type1
  }
  </code></pre>
  
  <p>I searched a lot and didn't find anything about how to do this.
  the only thing I thought of was using <code>StreamReader</code> and read the whole .cs file and find the type there in the text. But is there any faster/cleaner way to do this?</p>
  
  <p>Note: I'm not trying to get the type of Type1 I'm trying to get the string "Type1".</p>