title: How do I use LINQ to obtain a unique list of properties from a list of objects?
body: <p>I'm trying to use LINQ to return a list of ids given a list of objects where the id is a property. I'd like to be able to do this without looping through each object and pulling out the unique ids that I find.</p>
  <p>I have a list of objects of type MyClass and one of the properties of this class is an ID.</p>
  <pre><code>public class MyClass
  {
    public int ID { get; set; }
  }
  </code></pre>
  <p>I want to write a LINQ query to return me a list of those Ids.</p>
  <p>How do I do that, given an <code>IList&lt;MyClass&gt;</code> such that it returns an <code>IEnumerable&lt;int&gt;</code> of the ids?</p>
  <p>I'm sure it must be possible to do it in one or two lines using LINQ rather than looping through each item in the MyClass list and adding the unique values into a list.</p>