implementing Equals but not GetHashCode in c#
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/371328/why-is-it-important-to-override-gethashcode-when-equals-method-is-overriden-in-c">Why is it important to override GetHashCode when Equals method is overriden in C#?</a>  </p>
</blockquote>



<p>I dont implement the GetHashCode method of the Object class. so I get a number of warnings.</p>

<p>Is there a way to check for equality where I just check the hash code in the Equals method, so implement both Equals and GetHashCode and not get the "Object.GetHashCode not implemented warning?".</p>

<p>what will happen if i just implement the Equals and not implement the GetHashCode? instances of myclass are updatable in my application.</p>

<pre><code>public class MyClass{

private string x;
private string y;

public override bool Equals(object obj)
        {

            try
            {

                 return    Object.Equals(this.x, obj.x)
                        &amp;&amp; Object.Equals(this.y, obj.y);

            }
            catch(Exception Ex)
            {
                log.Debug(Ex.StackTrace);
                throw; 
            }
        }

}
</code></pre>
