title: Create Generic Class C#
body: <p>I'm working on a repository for a list of entities, and I should repeat thea same class more than once, the only difference is type type .. is there a way to make it generic?</p>
  
  <p>It should quite easy, for sure I don't know how to make this generic:</p>
  
  <pre><code> private Namespace.DAL.UserProfileRepository _rep = new Namespace.DAL.UserProfileRepository();
  </code></pre>
  
  <p>The class I'm repeating it this:</p>
  
  <pre><code>public class UserProfileRepository : IEntityRepository&lt;IUserProfile&gt;
  {
     private Namespace.DAL.UserProfileRepository _rep = new Namespace.DAL.UserProfileRepository();
  
     public IUserProfile[] GetAll()
     {
       return _rep.GetAll();
     }
  
     public IUserProfile GetById(int id)
     {
       return _rep.GetById(id);
     }
  
     public IQueryable&lt;IUserProfile&gt; Query(Expression&lt;Func&lt;IUserProfile, bool&gt;&gt; filter)
     {
       return _rep.Query(filter);
     }
  }
  </code></pre>