title: Most efficient way to remove duplicates from a List
body: <p>Let's say I have a List with duplicate values and I want to remove the duplicates.</p>
  
  <pre><code>List&lt;int&gt; myList = new List&lt;int&gt;(Enumerable.Range(0, 10000));
  
  // adding a few duplicates here
  myList.Add(1); 
  myList.Add(2);
  myList.Add(3);
  </code></pre>
  
  <p>I have found 3 approaches to solve this:</p>
  
  <pre><code>List&lt;int&gt; result1 = new HashSet&lt;int&gt;(myList).ToList(); //3700 ticks
  List&lt;int&gt; result2 = myList.Distinct().ToList(); //4700 ticks
  List&lt;int&gt; result3 = myList.GroupBy(x =&gt; x).Select(grp =&gt; grp.First()).ToList(); //18800 ticks
  //referring to pinturic's comment:
  List&lt;int&gt; result4 = new SortedSet&lt;int&gt;(myList).ToList(); //18000 ticks
  </code></pre>
  
  <p>In most answers here on SO, the <strong>Distinct</strong> approach is shown as the "correct one", yet the HashSet is always faster!</p>
  
  <p>My question: is there anything I have to be aware of when I use the <strong>HashSet</strong> approach and is there another more efficient way?</p>