title: How to create a HashSet<List<Int>> with distinct elements?
body: <p>I have a HashSet that contains multiple lists of integers - i.e. <code>HashSet&lt;List&lt;int&gt;&gt;</code></p>
  
  <p>In order to maintain uniqueness I am currently having to do two things:
  1. Manually loop though existing lists, looking for duplicates using <code>SequenceEquals</code>.
  2. Sorting the individual lists so that <code>SequenceEquals</code> works currently.</p>
  
  <p>Is there a better way to do this? Is there an existing IEqualityComparer that I can provide to the HashSet so that <code>HashSet.Add()</code> can automatically handle uniqueness?</p>
  
  <pre><code>var hashSet = new HashSet&lt;List&lt;int&gt;&gt;();
  
  for(/* some condition */)
  {
      List&lt;int&gt; list = new List&lt;int&gt;();
  
      ...
  
      /* for eliminating duplicate lists */
  
      list.Sort();
  
      foreach(var set in hashSet)
      {
          if (list.SequenceEqual(set))
          {
              validPartition = false;
              break;
          }
      }
  
      if (validPartition)
             newHashSet.Add(list);
  }
  </code></pre>