title: How can I get a generic parameter type name at compile time?
body: <p>I'm trying to implement a generic class. It should have a property with an attribute that takes a compile-time constant, which I want to set as the parameter type's name. Something like this:</p>
  
  <pre><code>namespace Example
  {
      public class MyGeneric&lt;T&gt;
      {
          [SomeAttribute(CompileTimeConstant)]
          public int MyProperty { get; set; }
  
          private const string CompileTimeConstant = typeof(T).Name; // error CS0133:
          // The expression being assigned to `Example.MyGeneric&lt;T&gt;.CompileTimeConstant' must be constant
      }
  }
  </code></pre>
  
  <p>But because <code>typeof(T).Name</code> is evaluated at run-time, it doesn't work. Is it possible?</p>