title: LINQ Distinct Query
body: <p>I have a C# application that loads a List of CLR objects called "Tasks". Each Task has the following properties:</p>
  
  <pre><code>public int ID { get; set; }
  public int TypeID { get; set; }
  public string TypeName { get; set; }
  public string Name { get; set; }
  </code></pre>
  
  <p>I am trying to find the unique types of tasks in this list. I thought I would try to use LINQ to do it. However, I cannot figure out how to do it. How do I say give me all of the unique TypeID and TypeName in this list? Currently I'm trying the following which is getting me no where. In fact, it wound even compile.</p>
  
  <pre><code>var uniqueTasks = allTasks.Distinct(p =&gt; p.TypeID);
  </code></pre>
  
  <p>Thank you,</p>