title: .Contains() on a list of custom class objects
body: <p>I'm trying to use the <code>.Contains()</code> function on a list of custom objects.</p>
  <p>This is the list:</p>
  <pre><code>List&lt;CartProduct&gt; CartProducts = new List&lt;CartProduct&gt;();
  </code></pre>
  <p>And the <code>CartProduct</code>:</p>
  <pre><code>public class CartProduct
  {
      public Int32 ID;
      public String Name;
      public Int32 Number;
      public Decimal CurrentPrice;
      /// &lt;summary&gt;
      /// 
      /// &lt;/summary&gt;
      /// &lt;param name=&quot;ID&quot;&gt;The ID of the product&lt;/param&gt;
      /// &lt;param name=&quot;Name&quot;&gt;The name of the product&lt;/param&gt;
      /// &lt;param name=&quot;Number&quot;&gt;The total number of that product&lt;/param&gt;
      /// &lt;param name=&quot;CurrentPrice&quot;&gt;The currentprice for the product (1 piece)&lt;/param&gt;
      public CartProduct(Int32 ID, String Name, Int32 Number, Decimal CurrentPrice)
      {
          this.ID = ID;
          this.Name = Name;
          this.Number = Number;
          this.CurrentPrice = CurrentPrice;
      }
      public String ToString()
      {
          return Name;
      }
  }
  </code></pre>
  <p>When I try to find a similar cartproduct within the list:</p>
  <pre><code>if (CartProducts.Contains(p))
  </code></pre>
  <p>it ignores similar cartproducts and I don't seem to know what it checks on - the ID? or at all?</p>