Duplicate: What is the best algorithm for an overridden System.Object.GetHashCode?
If you've written an object with a variety of data-members, how do you intelligently implement GetHashCode()?
One developer told me he just XORs (^ operator) the Hash of relevant data-fields, but I am unconvinced this is a "best-practices" implementation.
If I had my way, there would be functions Object.CombineHashes(Object[]), and/or Object.CombineHashes(int[]) to help intelligently build hashes of complex objects.
How would you write these functions?