title: What's better for creating distinct data structures: HashSet or Linq's Distinct()?
body: <p>I'm wondering whether I can get a consensus on which method is the better approach to creating a distinct set of elements: a <code>C# HashSet</code> or using <code>IEnumerable's .Distinct()</code>, which is a Linq function?</p>
  
  <p>Let's say I'm looping through query results from the DB with DataReader, and my options are to add the objects I construct to a <code>List&lt;SomeObject&gt;</code> or to a <code>HashSet&lt;SomeObject&gt;</code> With the <code>List</code> option, I would wind up having to do something like:</p>
  
  <p><code>myList = myList.Distinct().ToList&lt;SomeObject&gt;();</code></p>
  
  <p>With the <code>HashSet</code>, my understanding is that adding elements to it takes care of the non-duplication by itself, assuming you've overrided the <code>GetHashCode()</code> and <code>Equals()</code> methods in SomeObject. I'm concerned mainly with the risks and performance aspects of the options.</p>
  
  <p>Thanks.</p>