Overridding Equals and GetHash
<p>I have read that when you override Equals on an class/object you need to override GetHashCode.</p>

<pre><code> public class Person : IEquatable&lt;Person&gt;
    {
        public int PersonId { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }

        public Person(int personId, string firstName, string lastName)
        {
            PersonId = personId;
            FirstName = firstName;
            LastName = lastName;

        }

        public bool Equals(Person obj)
        {
            Person p = obj as Person;

            if (ReferenceEquals(null, p)) 
                return false;
            if (ReferenceEquals(this, p)) 
                return true;

            return Equals(p.FirstName, FirstName) &amp;&amp; 
                   Equals(p.LastName, LastName);
        }


    }
</code></pre>

<p>Now given the following:</p>

<pre><code> public static Dictionary&lt;Person, Person&gt; ObjDic= new Dictionary&lt;Person, Person&gt;();
 public static Dictionary&lt;int, Person&gt; PKDic = new Dictionary&lt;int, Person&gt;();
</code></pre>

<p>Will not overridding the GetHashCode affect both of the Dictionary's above? What I am basically asking is how is GetHashCode generated? IF I still look for an object in PKDic will I be able to find it just based of the PK. If I wanted to override the GetHashCode how would one go about doing that?</p>
