title: Use a delegate for the equality comparer for LINQ's Distinct()
body: <p>I have a LINQ Distinct() statement that uses my own custom comparer, like this:</p>
  
  <pre><code>class MyComparer&lt;T&gt; : IEqualityComparer&lt;T&gt; where T : MyType
  {
      public bool Equals(T x, T y)
      {
          return x.Id.Equals(y.Id);
      }
  
      public int GetHashCode(T obj)
      {
          return obj.Id.GetHashCode();
      }
  }
  
  ...
  
  var distincts = bundle.GetAllThings.Distinct(new MyComparer&lt;MySubType&gt;());
  </code></pre>
  
  <p>This is all fine and dandy and works as I want. Out of curiosity, do I need to define my own Comparer, or can I replace it with a delegate? I thought I should be able to do something like this:</p>
  
  <pre><code>var distincts = bundle.GetAllThings.Distinct((a,b) =&gt; a.Id == b.Id);
  </code></pre>
  
  <p>But this doesn't compile. Is there a neat trick?</p>