O'Reilly logo
  • Ismael Lanchas thinks this is interesting:

The IEquatable<T> interface

A consequence of calling object.Equals is that it forces boxing on value types. This is undesirable in highly performance-sensitive scenarios because boxing is relatively expensive compared to the actual comparison. A solution was introduced in C# 2.0, with the IEquatable<T> interface:

public interface IEquatable<T>
  bool Equals (T other);

The idea is that IEquatable<T>, when implemented, gives the same result as calling object’s virtual Equals method—but more quickly. Most basic .NET types implement IEquatable<T>. You...


Cover of C# 6.0 in a Nutshell, 6th Edition


Para mejorar el rendimiento en genéricos y evitar el boxing de tipos de valor, se implementa IEquatable<T>. La mayoría de clases nativas de .NET lo implementan por este motivo.