title: Comparing two dictionaries for equal data in c#?
body: <p>I have two dictionaries containing a string key and then an object. The object contains five fields. Is there an elegant way to ensure both dictionaries first contain the same keys and then if this is correct, contain the same five fields per object?</p>
  
  <p>Would the two dictionaries have the same in-built hashcode or something?</p>
  
  <p>EDIT, doesn't appear to be working for the following code:</p>
  
  <pre><code>Dictionary&lt;string, MyClass&gt; test1 = new Dictionary&lt;string, MyClass&gt;();
  Dictionary&lt;string, MyClass&gt; test2 = new Dictionary&lt;string, MyClass&gt;();
  
  MyClass i = new MyClass("", "", 1, 1, 1, 1);
  MyClass j = new MyClass("", "", 1, 1, 1, 1);
  
  test1.Add("1", i);
  test2.Add("1", j);
  
  bool equal = test1.OrderBy(r =&gt; r.Key).SequenceEqual(test2.OrderBy(r =&gt; r.Key));
  
  class MyClass
  {
      private string a;
      private string b;
      private long? c;
      private decimal d;
      private decimal e;
      private decimal f;
  
      public MyClass(string aa, string bb, long? cc, decimal dd, decimal ee, decimal ff)
      {
          a= aa;
          b= bb;
          c= cc;
          d= dd;
          e= ee;
          f= ff;
      }
  </code></pre>
  
  <p>this returns false?</p>