Below is a sample implementation of overriding Object.Equals() for an entity base class from which all other entities in an application derive.
All entity classes have t
What Jon Skeet answered is a good solution, however, you might want to add an unchecked code block to allow integer overflowing
unchecked
{
int hash = ...;
return hash
}
https://msdn.microsoft.com/en-us/library/khy08726(v=vs.140).aspx
If neither checked nor unchecked is specified, the default context depends on external factors such as compiler options.
I'd also like to add, again, that using base.GetHashCode()
on POCO's will call the default object.GetHashCode
. That's definitely not what you want...