title: C# Language: generics, open/closed, bound/unbound, constructed
body: <p>I'm reading book "the  C# programming Language", 4th Edition, by Anders Hejlsberg etc.</p>
  
  <p>There are several definitions that are a bit twisting:</p>
  
  <p><strong>unbound generic type</strong>: A generic type declaration, by itself, denotes an unbound generic type ...</p>
  
  <p><strong>constructed type</strong>: A type that includes at least one type argument is called a constructed type.</p>
  
  <p><strong>open type</strong>: An open type is a type that involves type parameters.</p>
  
  <p><strong>closed type</strong>: A closed type is a type that is not an open type.</p>
  
  <p><strong>unbound type</strong>: refers to a nongeneric type or an unbound generic type.</p>
  
  <p><strong>bound type</strong>: refers to a nongeneric type or a constructed type.
  [annotate] ERIC LIPPERT: Yes, nongeneric types are considered to be both bound and unbound.</p>
  
  <p><em><strong>Question 1</em></strong>, is below what I listed correct? </p>
  
  <pre><code>int                     //non-generic, closed, unbound &amp; bound, 
  class A&lt;T, U, V&gt;        //generic,     open,   unbound, 
  class A&lt;int, U, V&gt;      //generic,     open,   bound, constructed 
  class A&lt;int, int, V&gt;    //generic,     open,   bound, constructed
  class A&lt;int, int, int&gt;  //generic,     closed, bound, constructed
  </code></pre>
  
  <p><em><strong>Question 2</em></strong>, The books says
  "An unbound type refers to the entity declared by a type declaration. 
  An unbound generic type is not itself a type, and it cannot be used as the type of a variable, argument, or return value, or as a base type. 
  The only construct in which an unbound generic type can be referenced is the typeof expression (§7.6.11)."
  Fine, but below is a small testing program that can compile:</p>
  
  <pre><code>public class A&lt;W, X&gt; { }
  
  // Q2.1: how come unbounded generic type A&lt;W,X&gt; can be used as a base type?
  public class B&lt;W, X&gt; : A&lt;W, X&gt; { } 
  
  public class C&lt;T,U,V&gt;
  {
      // Q2.2: how come unbounded generic type Dictionary&lt;T, U&gt; can be used as a return value?
      public Dictionary&lt;T,U&gt; ReturnDictionary() { return new Dictionary&lt;T, U&gt;(); }
  
      // Q2.3: how come unbounded generic type A&lt;T, U&gt; can be used as a return value?
      public A&lt;T, U&gt; ReturnB() { return new A&lt;T, U&gt;(); }
  }
  </code></pre>