title: Using a class nested in a generic class as type parameter in C#
body: <p>Having the following definition:</p>
  
  <pre><code>public class Generic&lt;T&gt;
  {
      public class Nested { }
  }
  </code></pre>
  
  <p>And given that ECMA ref §25.1 states:</p>
  
  <blockquote>
    <p>Any class nested inside a generic class declaration or a generic
    struct declaration (§25.2) is itself a generic class declaration,
    since type parameters for the containing type shall be supplied to
    create a constructed type.</p>
  </blockquote>
  
  <p>I understand that <code>Nested</code> requires the type parameter in order to be instantiated.</p>
  
  <p>I can obtain the generic <code>Type</code> with <code>typeof</code>:</p>
  
  <pre><code>var type = typeof(Generic&lt;&gt;.Nested); 
  // type.FullName: Namespace.Generic`1+Nested
  </code></pre>
  
  <p>Is there any way I can use it as a type parameter for a generic method such as the following?</p>
  
  <pre><code>var tmp = Enumerable.Empty&lt;Generic&lt;&gt;.Nested&gt;(); 
  // Error: Unexpected use of an unbound generic
  </code></pre>
  
  <p>As stated before, from the ECMA specification I understand that all the type parameters must be satisfied before instancing but no objects are being created here. Furthermore, the <code>Nested</code> class does not make use of the type parameters in any way: I simply would like to define it nested for code organization purposes.</p>