title: Interface method return type to be class that implements the interface
body: <p>I'm having trouble getting my head around interfaces. After trawling through similar questions on here, I've come up with the following interface, for defining the CRUD operations required for all my classes:</p>
  
  <pre><code>public interface IData&lt;T&gt;
  {
      IData&lt;T&gt; Select(int id);
      List&lt;T&gt; SelectMultiple();
      void Insert();
      void Update();
      void Delete();
  }
  </code></pre>
  
  <p>This is then implemented within my partial classes:</p>
  
  <pre><code>public partial class Post : IData&lt;Post&gt;
  {
      public IData&lt;Post&gt; Select(int id)
      {
          MyDataContext dc = MyDataContext.Create();
          return dc.Posts.Single(p =&gt; p.PostID == id);
      }
  
      public List&lt;Post&gt; SelectMultiple()
      {
          MyDataContext dc = MyDataContext.Create();
          return dc.Posts.ToList();
      }
  
      // Update() and Delete() declarations
  }
  </code></pre>
  
  <p>This all compiles fine, however if I try to use the Post Select() method:</p>
  
  <pre><code>Post p = new Post().Select(1);
  </code></pre>
  
  <p>It fails with <em>Cannot implicitly convert type 'IData' to 'Post'. An explicit conversion exists (are you missing a cast?)</em></p>
  
  <p>Which makes sense, but how do I have it so that it doesn't require a Cast? I want the Select to return a Post (but not define Post as the return type at the interface level). Have I misunderstood interfaces, or is there a quick alteration I can make?</p>