How does the default implementation for GetHashCode() work? And does it handle structures, classes, arrays, etc. efficiently and well enough?
I am trying to decide in what cases I should pack my own and in what cases I can safely rely on the default implementation to do well. I don’t want to reinvent the wheel, if at all possible.
InternalGetHashCode is mapped to an ObjectNative::GetHashCode function in the CLR, which looks like this:
The full implementation of GetHashCodeEx is fairly large, so it’s easier to just link to the C++ source code.