title: c# Interfaces - Implicit Conversion Error?
body: <p>If I have this interface:</p>
  
  <pre><code>public interface IFoo : IDisposable
  { 
      int PropA {get; set;}
      int PropB {get; set;}
  }
  </code></pre>
  
  <p>And a class:</p>
  
  <pre><code>public class Foo : IFoo
  {
      public int PropA {get; set;}
      public int PropB {get; set;}
  
      public void Dispose()
      {
          Dispose();
          GC.SuppressFinalize(this);
      }
  }
  </code></pre>
  
  <p>Shouldn't this work without a 'Cannot Implicitly Convert' error?</p>
  
  <pre><code>    private Context context = new Context();
      private GenericRepository&lt;IFoo&gt; FooRepo;
  
      public GenericRepository&lt;IFoo&gt; Article
      {
          get
          {
              if (this.FooRepo == null)
              {
                  this.FooRepo = new GenericRepository&lt;Foo&gt;(context);
              }
              return FooRepo;
          }
      }
  </code></pre>
  
  <p>I thought I had it right, what is the correct way to do this?</p>