Usually, if a structure implements an interface, assigning such a structure to an interface variable causes a box, for example:
interface IFoo {}
struct S : IFoo {}
S s = ...
IFoo f = s;
However, there are exceptions. It seems that the implementation IEquatable<T>and use of such a structure in the dictionary as a key will not lead to boxing. So the question is, what if I just redefine GetHashCodewithout implementation IEquatable<T>? Will he fall into some special case?
source
share