title: Cannot convert Generic Class to Generic Interface, why?
body: <p>I have an IRepository interface that inherits from <code>IRepository&lt;TObject&gt;</code>. I also have a SqlRepository class that inherits from S<code>QLRepository&lt;TObject&gt;</code>, which in turn implements <code>IRepository&lt;TObject&gt;</code>. Why can't I instantiate a instance of SqlRepository as an IRepository?</p>
  
  <pre><code>public class MyObject : IObject {
      ...
  }
  
  public interface IRepository&lt;TObject&gt; where TObject : IObject, new() {
      ...
  }
  
  public interface IRepository : IRepository&lt;MyObject&gt; { }
  
  public class SqlRepository&lt;TObject&gt; : IRepository&lt;TObject&gt; where TObject : IObject, new() {
      ...
  }
  
  public class SqlRepository : SqlRepository&lt;MyObject&gt; { }
  
  public class Controller {
      private IRepository _repository;
  
      public Controller() {
          _repository = new SqlRepository();
      }
  }
  </code></pre>
  
  <p>The example above fails when trying to assign a new SqlRepository to _repository in the Controller class, with the following error message.</p>
  
  <pre><code>Argument '1': cannot convert from 'SqlRepository' to 'IRepository'
  </code></pre>
  
  <p>Which basic principle of inheritance have I failed to grasp, please help.</p>