title: Comparing 2 Dictionary<string, string> Instances
body: <p>I want to compare the contents of two <code>Dictionary&lt;string, string&gt;</code> instances regardless of the order of the items they contain.  <code>SequenceEquals</code> also compares the order, so I first order the dictionaries by key and then call <code>SequenceEquals</code>.  </p>
  
  <p>Is there a method that I can use instead of <code>SequenceEquals</code> that will only compare the contents?</p>
  
  <p>If there isn't, is this the ideal way to do this?</p>
  
  <pre><code>Dictionary&lt;string, string&gt; source = new Dictionary&lt;string, string&gt;();
  Dictionary&lt;string, string&gt; target = new Dictionary&lt;string, string&gt;();
  
  source["foo"] = "bar";
  source["baz"] = "zed";
  source["blah"] = null;
  
  target["baz"] = "zed";
  target["blah"] = null;
  target["foo"] = "bar";
  
  // sequenceEquals will be false
  var sequenceEqual = source.SequenceEqual(target);
  // contentsEqual will be true
  var contentsEqual = source.OrderBy(x =&gt; x.Key).SequenceEqual(target.OrderBy(x =&gt; x.Key));
  </code></pre>