title: How to return Type T in interface in C#?
body: <p>I have an interface like this:</p>
  
  <pre><code>public interface IUser{
      //some properties here
  
      T ToDerived(User u);
  }
  </code></pre>
  
  <p>I'm new to interface development, so here's what I'm trying to accomplish. I will have a base class </p>
  
  <pre><code>public class User 
  </code></pre>
  
  <p>that does NOT implement the above interface. Then I will have a derived class </p>
  
  <pre><code>SalesUser : User, IUser
  {
      //no properties needed because they exist in the User class
  
      SalesUser ToDerived(User u)
      {
          //code for converting a base User to a derived SalesUser
      }
  }
  </code></pre>
  
  <p>I would like to write the function for ToDerived(User u) in the SalesUser class, but in the interface, I do not know how to define this as the ToDerived method declaration that I have now in the interface is not compiling.</p>
  
  <p>I hope this makes sense.</p>