C# Dictionary issue for reference type as Key
<p>I have class that implements interface as below</p>

<pre><code>class Person : IHuman
{
}
</code></pre>

<p>I have created dictionary as below</p>

<pre><code>Dictionary &lt;IHuman, collection&lt;int&gt;&gt; dic = new Dictionary &lt;IHuman, collection&lt;int&gt;&gt;();
</code></pre>

<p>Now I add one key value pair as belwow</p>

<pre><code>dic.Add (person, myCollection);
</code></pre>

<p>Again when I use containsKey for "same person object and with same HashCode" as below</p>

<pre><code>if (dic.ContainsKey(person))
{
    dic[person] = mynewcollection;
}
else
{
    dic.Add (person, mynewcollection);
}
</code></pre>

<p>Here ContainsKey() returns false and creates one more key value pair with same person object.</p>

<p>I wondered how it possible...
Please help me to sort out this issue.</p>
