title: Covariance for generic classes
body: <p>Is there any way in C# to achieve the following:</p>
  
  <pre><code>class MyClass&lt;T&gt;  where T : BaseTypeInner {}
  
  class BaseTypeInner {}
  
  class A : BaseTypeInner {}
  
  class B : BaseTypeInner {}
  
  void Main()
  {
      MyClass&lt;BaseTypeInner&gt; variant;
  
      variant = new MyClass&lt;A&gt; (); // ERROR: Cannot implicitly convert type 'UserQuery.MyClass&lt;UserQuery.A&gt;' to 'UserQuery.MyClass&lt;UserQuery.BaseTypeInner&gt;'
  
      variant = new MyClass&lt;B&gt; ();
  }
  </code></pre>