I would say that for any structure you always need to manually code the overrides of Equals() and GetHashCode() together with the implementation of IEquatable<T> , if at all possible, that it can be used by someone as a key, so I, of course, I will not use it not to do this.
As with boxing, the default implementation is rather slow, as it uses reflection to examine fields. In addition, there is an error, at least in some versions of the framework (the implementation is reasonably optimized as a binary comparison when it gives the correct results, but, unfortunately, incorrectly evaluates when this is the case, and therefore two structures containing equivalent decimal fields can be considered unequal).
If you need a fast composition that does not make any difference to the system, except for a composite key, I would recommend using Tuple . Tuple.Create() makes it easy to compile, and the overrides for Equals() and GetHashCode() pretty reasonable.
In some cases, it can also be useful to use anonymous classes as keys (only in the context of this method), and here the overrides for Equals() and GetHashCode() also quite reasonable.
source share