Proper way to write GetHashCode() when Equality Comparer is based on OR operation?
问题 I'm trying to write an Equality Comparer for a simple class with 3 fields, like so: public class NumberClass { public int A { get; set; } public int B { get; set; } public int C { get; set; } } My condition for two objects of NumberClass to be equal is if Obj1.A == Obj2.A || Obj1.B == Obj2.B (in other words, OR), Obj1 and Obj2 being instances of NumberClass . I can easily write the Equals() of my comparer as follows, but I don't know what to do with my GetHashCode() method. public bool Equals