title: Use custom object as Dictionary Key
body: <p>I want to use a custom object as a Dictionary key, mainly, I have something like this: (I can't use .net 4.0 so I don't have tuples)</p>
  
  <pre><code>class Tuple&lt;A, B&gt; : IEquatable&lt;Tuple&lt;A,B&gt;&gt;
  {
    public A AValue { get; set; }
    public B BValue { get; set; }
  
    public Tuple(A a, B b){ AValue = a; BValue = b; }
  
    public bool Equals(Tuple&lt;A, B&gt; tuple)
    {
      return tuple.AValue.Equals(AValue) &amp;&amp; tuple.BValue.Equals(BValue);
    }
  
    public bool Equals(object o)
    {
    return this.Equals(o as Tuple&lt;A,B&gt;);
    }
  }
  </code></pre>
  
  <p>I then do something like this.</p>
  
  <pre><code>  var boolmap = new Dictionary&lt;Tuple&lt;bool, bool&gt;, string&gt;();
    boolmap.Add(new Tuple&lt;bool,bool&gt;(true, true), "A");
    boolmap.Add(new Tuple&lt;bool,bool&gt;(true, false), "B");
    boolmap.Add(new Tuple&lt;bool,bool&gt;(false, true), "C");
    boolmap.Add(new Tuple&lt;bool,bool&gt;(false, false), "D");
    var str = boolmap[new Tuple&lt;bool,bool&gt;(true, false)];
  </code></pre>
  
  <p>I get a KeyNotFound exception at the last line. Why is this ? Isn't it enough I implement IEquatable ?</p>
  
  <p>Thanks</p>