I have a class Person for which I have to override the Equals and GetHashCode method. Two person objects are equals if the Name matches OR if the Email matches. What's a good way of doing this with a considerably efficient hash function?
class Person { string Name string Email public override Equals(object obj) { if (ReferenceEquals(obj, null)) return false; if (ReferenceEquals(this, obj)) return true; if (obj is Person) { Person person = (Person)obj; return (this.Name == person.Name) || (this.Email == person.Email); } return false; } public override GetHashCode() { // What's a good way to implement? } }