C# Journey into struct equality comparison, deep dive
A great post that dives into reasoning behind implementing IEquatable<>: where exactly allocations happen and that default ValueType Equals implementation uses structural comparison only for tightly packed structs, otherwise field-by-field comparison is used which utilizes reflection.
For us it means that we must implement IEquatable<> in our structs in case they are compared, which is common case when used in collections (dictionary, list, array, etc).
https://medium.com/@semuserable/c-journey-into-struct-equality-comparison-deep-dive-9693f74562f1
#performance #equals
Post #2287
349