Why is ‘397’ used for ReSharper GetHashCode override?

Probably because 397 is a prime of sufficient size to cause the result variable to overflow and mix the bits of the hash somewhat, providing a better distribution of hash codes. There’s nothing particularly special about 397 that distinguishes it from other primes of the same magnitude.

Leave a Comment