How to use a custom generic type as a key in a Dictionary?
<p>I want to use a custom generic class as a key in a dictionary. How should I override <code>Equals</code> and <code>GetHashCode</code>?</p>

<p>Eg, </p>

<pre><code>public class SomeKey&lt;T,V&gt;
{
    public T Value1 { get; set; }
    public V Value2 { get; set; }

    public SomeKey(T val1, V val2)
    {
        this.Value1 = val1;
        this.Value2 = val2;
    }

    public override bool Equals(SomeKey&lt;T,V&gt; otherKey)
    {
        //whats the best option here?
    }

    public override int GetHashCode()
    {
        //whats the best option here?
    }
}
</code></pre>

<p>Thanks</p>
