title: .NET Generic Method Question
body: <p>I'm trying to grasp the concept of .NET Generics and actually use them in my own code but I keep running into a problem.</p>
  
  <p>Can someone try to explain to me why the following setup does not compile?</p>
  
  <pre><code>public class ClassA
  {
      ClassB b = new ClassB();
  
      public void MethodA&lt;T&gt;(IRepo&lt;T&gt; repo) where T : ITypeEntity
      {
          b.MethodB(repo);
      }
  }
  
  public class ClassB
  {
      IRepo&lt;ITypeEntity&gt; repo;
  
      public void MethodB(IRepo&lt;ITypeEntity&gt; repo)
      {
          this.repo = repo;
      }
  }
  </code></pre>
  
  <p>I get the following error:<br>
  cannot convert from IRepo&lt;'T> to IRepo&lt;'ITypeEntity></p>
  
  <p>MethodA gets called with a IRepo&lt;'DetailType> object parameter where DetailType inherits from ITypeEntity.</p>
  
  <p>I keep thinking that this should compile as I'm constraining T within MethodA to be of type ITypeEntity.</p>
  
  <p>Any thoughts or feedback would be extremely helpful.</p>
  
  <p>Thanks.</p>
  
  <p><b>Edit:</b> Nick R has a great suggestion but unfortunately in my context, I don't have the option of making ClassA Generic.  ClassB could be though.</p>