SortedDictionary<TKey, TValue>: check if contents equal to another SortedDictionary?
<p>just wondering:if I have two SortedDictionary objects, what is the fastest way to find out if their contents are the same?
Looping all keys and checking the values does not sound like the best solution.
Will it be enough to just check GetHashCode()?</p>

<p>Edit: I have tried around a bit. See this code:</p>

<pre><code>SortedDictionary&lt;string, string&gt; o1 = new SortedDictionary&lt;string, string&gt;( );
SortedDictionary&lt;string, string&gt; o2 = new SortedDictionary&lt;string, string&gt;( );
o1["k1"] = "v1";
o1["k2"] = "v2";
o1["k3"] = "v3";

o2["k2"] = "v2";
o2["k1"] = "v1";
o2["k3"] = "v3";

Console.WriteLine( "o1:" );
foreach ( KeyValuePair&lt;string, string&gt; oKeyValuePair in o1 )
{
    Console.WriteLine( oKeyValuePair.GetHashCode( ) );
}
Console.WriteLine( "o2:" );
foreach ( KeyValuePair&lt;string, string&gt; oKeyValuePair in o2 )
{
    Console.WriteLine( oKeyValuePair.GetHashCode( ) );
}
Console.ReadKey( );
</code></pre>

<p>The hash codes for the individual key-value-pairs are the same for both sorted dictionaries, even though the order the values were added differ. This is good.
So I'm missing one step: how do I get ONE unique hash code from all the hash codes?</p>

<p>René</p>
