title: The type 'T' cannot be used as type parameter in the generic type or method error when type is known
body: <p>Consider the following code sample, where <code>Concrete</code> derives from <code>Base</code>:</p>
  
  <pre><code>class Base{}
  class Concrete : Base {}
  
  static void Foo&lt;T&gt;() where T : Base
  {
      if (typeof(Concrete).IsAssignableFrom(typeof(T)))
      {
          var x = new Bar&lt;T&gt;(); // compile error on this line
      }
  }
  
  class Bar&lt;T&gt; where T : Concrete
  {
  }
  </code></pre>
  
  <p>On the line where I am having the compile error, I have already checked that the generic argument is assignable to the <code>Concrete</code> type. So in theory I believe there should be a way to create an instance of the Bar class.</p>
  
  <p><strong>Is there any way I can remove the compile error? I cannot think of a way to cast the argument.</strong></p>
  
  <hr>
  
  <p>Full text of compile error:</p>
  
  <blockquote>
    <p>Error 14  The type 'T' cannot be used as type parameter 'T' in the
    generic type or method
    'Bar'. There
    is no implicit reference conversion from 'T' to
    'Concrete'.</p>
  </blockquote>