Defines methods to support the comparison of objects for equality.
Assembly: mscorlib (in mscorlib.dll)
- in T
The type of objects to compare.
This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
Thetype exposes the following members.
This interface allows the implementation of customized equality comparison for collections. That is, you can create your own definition of equality for type T, and specify that this definition be used with a collection type that accepts the generic interface. In the .NET Framework, constructors of the Dictionary<TKey, TValue> generic collection type accept this interface.
This interface supports only equality comparisons. Customization of comparisons for sorting and ordering is provided by the IComparer<T> generic interface.
We recommend that you derive from the EqualityComparer<T> class instead of implementing the interface, because the EqualityComparer<T> class tests for equality using the IEquatable<T>::Equals method instead of the Object::Equals method. This is consistent with the Contains, IndexOf, LastIndexOf, and Remove methods of the Dictionary<TKey, TValue> class and other generic collections.
.NET FrameworkSupported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
XNA FrameworkSupported in: 3.0, 2.0, 1.0
Portable Class LibrarySupported in: Portable Class Library
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8