Possible Duplicate:
Why is it important to override GetHashCode when Equals method is overriden in C#?
I dont implement the GetHashCode method of the Object class. so I get a number of warnings.
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?".
what will happen if i just implement the Equals and not implement the GetHashCode? instances of myclass are updatable in my application.
public class MyClass{
private string x;
private string y;
public override bool Equals(object obj)
        {
            try
            {
                 return    Object.Equals(this.x, obj.x)
                        && Object.Equals(this.y, obj.y);
            }
            catch(Exception Ex)
            {
                log.Debug(Ex.StackTrace);
                throw; 
            }
        }
}
 
     
     
     
    