title: How to generate a unique hash for a collection of objects independent of their order
body: <p>Let's say I have a class</p>
  
  <pre><code>public class MyClass
  {
      public string Type { get; set; }
      public int Id { get; set; }
  }
  </code></pre>
  
  <p>and I have a collection class that is simply a strongly typed List</p>
  
  <pre><code>public class MyClassList : List&lt;MyClass&gt;
  {
      public MyClassList(IEnumerable&lt;MyClass&gt; enumerable) : base (enumerable) {}
  }
  </code></pre>
  
  <p>I want <code>MyClassList</code> to be able to generate a unique hash-code for <code>MyClassList</code> based on the contents. The hash-code of <code>MyClass</code> should be based on both properties. <strong>The hash-code of <code>MyClassList</code> should be the same even if the order of the objects is different</strong>.</p>
  
  <p>To handle the ordering issue I was thinking I could order the list before generating the hash-code, but I'm not sure how to generate the hash-code of the list.</p>