title: IEnumerable<T>.Contains with predicate
body: <p>I need just to clarify that given collection contains an element. </p>
  
  <p>I can do that via <code>collection.Count(foo =&gt; foo.Bar == "Bar") &gt; 0)</code> but it will do the unnecessary job - iterate the whole collection while I need to stop on the first occurrence.</p>
  
  <p>But I want to try to use <code>Contains()</code> with a predicate, e.g. <code>foo =&gt; foo.Bar == "Bar"</code>.</p>
  
  <p>Currently <code>IEnumerable&lt;T&gt;.Contains</code> has two signatures:</p>
  
  <ul>
  <li><p><code>IEnumerable&lt;T&gt;.Contains(T)</code></p></li>
  <li><p><code>IEnumerable&lt;T&gt;.Contains(T, IEqualityComparer&lt;T&gt;)</code></p></li>
  </ul>
  
  <p>So I have to specify some variable to check:</p>
  
  <pre><code>var collection = new List&lt;Foo&gt;() { foo, bar };
  collection.Contains(foo);
  </code></pre>
  
  <p>or write my custom <code>IEqualityComparer&lt;Foo&gt;</code> which will be used against my collection:</p>
  
  <pre><code>class FooComparer : IEqualityComparer&lt;Foo&gt;
  {
      public bool Equals(Foo f1, Foo f2)
      {
          return (f1.Bar == f2.Bar); // my predicate
      }
  
      public int GetHashCode(Foo f)
      {
          return f.GetHashCode();
      }   
  }
  </code></pre>
  
  <p>So are there any other methods to use predicate?</p>