GetHashCode inside CLR: Value types
In the previous article, we talked a bit about hash codes and how they are implemented for reference types - it turned out that it’s just a simple multiplication of thread ID and a random number. Today, we will do the same thing for value types, which are far more complex due to their representation in memory. In the end, I will show a small benchmark to prove that every struct defined by the programmer should override GetHashCode method. Time to dig into CLR source code!