title: How should I extract a collection of distinct values from a List<T> of custom objects?
body: <p>I've got a List of objects - let's say they're Orders.</p>
  
  <p><strong>Order</strong><br>
  <code>OrderID<br>
  Date<br>
  SalesmanId<br>
  ...
  </code></p>
  
  <p>I want to extract a <code>Distinct</code> list of <code>SalesmanId</code>s from this list. What is the best way to do this? I don't suppose its looping through manually ...  is it?</p>
  
  <p><strong>UPDATE</strong>
  Thanks for your responses. I've thought of an extra requirement (outlined after Jon Skeets answer) and coded it like this:</p>
  
  <pre><code>var salesusers = from s in lstOrders 
                   group s by new { s.SalesUserId,s.Username} 
                   into g  
                   select new { UserName = g.Key.Username, UserId = g.Key.SalesUserId };
  </code></pre>
  
  <p>It works, but I'm not sure if this is the right sort of approach or if I'm way off the mark?</p>
  
  <p>Thanks.</p>
  
  <p><strong>UPDATE #2:</strong> 
  This one ran and ran - newbies like me might find answers to this <a href="https://stackoverflow.com/questions/6276974/working-with-lists-anonymous-types-and-suchlike/6277153#6277153">linked question</a> useful too.</p>