title: Using Generics in an IEqualityComparer in C#
body: <p>I have a C# class defined like this:</p>
  
  <pre><code>public class Group&lt;T&gt; : ICloneable where T : CustomGroup
  {
    ...
  }
  </code></pre>
  
  <p>When I had originally implemented this, it was without generics. However, due to some new requirements, I've had to utilize generics on this class. Now, this class had an <code>IEqualityComparer</code>. It worked in it's pre-generics implementation. However, now, I'm not sure how to to define the class and method signatures.</p>
  
  <pre><code>public class GroupComparer : IEqualityComparer&lt;Group&gt;
  {
    public bool Equals(Group a, Group b)
    {
      return (a.Id == b.Id);
    }
  
    public int GetHashCode(Group obj)
    {
      return obj.GetHashCode();
    }
  }
  </code></pre>
  
  <p>This no longer compiles saying "Using the generic type Group requires 1 type arguments". However, I'm not sure how to update the class and method signatures to support <code>Group&lt;T&gt;</code> where T has to be a <code>CustomGroup</code>.</p>
  
  <p>Is there a way to do this? If so, how?</p>