title: Unable to cast object of type 'System.Int32' to type 'Product'. in distinct List
body: <p>I'm using Linq to Sql.</p>
  
  <p>Here's the data in my database</p>
  
  <pre><code>Cat 20 is Stationery
  Cat 30 is Computer Items
  Cat 40 is Toiletry
  
  **Id CatId ProductName**
  1   20     Pencil
  1   20     Pen
  1   30     Compact Disc
  1   30     USB
  1   30     Hard drive
  1   40     Toothpaste
  1   40     Toothbrush
  </code></pre>
  
  <p>I retrieve all my products as below</p>
  
  <pre><code>List&lt;Product&gt; c = myContext.GetProducts(activeStatus).ToList();
  </code></pre>
  
  <p>This works when i bind the data to my datasource (Gridview, Repeater etc on my ASPX web forms page).</p>
  
  <p>I now want to get all distinct products by category so i create the below code</p>
  
  <pre><code>List&lt;Product&gt; cats = c.Select(cat =&gt; cat.CatId).Distinct().ToList();
  </code></pre>
  
  <p>But this produces the error </p>
  
  <blockquote>
    <p>"Unable to cast object of type 'System.Int32' to type 'Product'</p>
  </blockquote>
  
  <p>Where am i going wrong?</p>