title: Linq Contains method for a object
body: <p>I have a object <code>User</code> and it is the following class:</p>
  
  <pre><code>public class User
  {
      public int ID { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>And I have a <code>IEnumerable&lt;User&gt;</code></p>
  
  <p>I want to find out if one specific user exists in <code>IEnumerable&lt;User&gt;</code>, comparing the user by it's ID.</p>
  
  <p>An example:</p>
  
  <pre><code>IList&lt;User&gt; users = GetUsers();     // 1, 2, 3
  IEnumerable&lt;User&gt; list = GetList(); // 2, 5, 8
  
  // this doesn't work
  list.Contains(users[0].ID);         // false
  list.Contains(users[1].ID);         // true !
  list.Contains(users[2].ID);         // false
  </code></pre>
  
  <p>How can I do it? And what is the fastest way to retrieve this boolean, is it Contains?</p>