﻿<?xml version="1.0" encoding="utf-8"?><Type Name="IEqualityComparer&lt;T&gt;" FullName="System.Collections.Generic.IEqualityComparer&lt;T&gt;"><TypeSignature Language="C#" Value="public interface IEqualityComparer&lt;in T&gt;" /><TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IEqualityComparer`1&lt;- T&gt;" /><AssemblyInfo><AssemblyName>mscorlib</AssemblyName><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><TypeParameters><TypeParameter Name="T"><Constraints><ParameterAttribute>Contravariant</ParameterAttribute></Constraints></TypeParameter></TypeParameters><Interfaces /><Docs><typeparam name="T">To be added.</typeparam><since version=".NET 2.0" /><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>This interface allows the implementation of customized equality comparison for collections. That is, you can create your own definition of equality for type <paramref name="T" />, and specify that this definition be used with a collection type that accepts the <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> generic interface. In the .NET Framework, constructors of the <see cref="T:System.Collections.Generic.Dictionary`2" /> generic collection type accept this interface.</para><para>A default implementation of this interface is provided by the <see cref="P:System.Collections.Generic.EqualityComparer`1.Default" /> property of the <see cref="T:System.Collections.Generic.EqualityComparer`1" /> generic class. The <see cref="T:System.StringComparer" /> class implements <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> of type <see cref="T:System.String" />. </para><para>This interface supports only equality comparisons. Customization of comparisons for sorting and ordering is provided by the <see cref="T:System.Collections.Generic.IComparer`1" /> generic interface. </para><para>We recommend that you derive from the <see cref="T:System.Collections.Generic.EqualityComparer`1" /> class instead of implementing the <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> interface, because the <see cref="T:System.Collections.Generic.EqualityComparer`1" /> class tests for equality using the <see cref="M:System.IEquatable`1.Equals(`0)" /> method instead of the <see cref="M:System.Object.Equals(System.Object)" /> method. This is consistent with the Contains, IndexOf, LastIndexOf, and Remove methods of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class and other generic collections.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Defines methods to support the comparison of objects for equality.</para></summary></Docs><Members><Member MemberName="Equals"><MemberSignature Language="C#" Value="public bool Equals (T x, T y);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool Equals(!T x, !T y) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Boolean</ReturnType></ReturnValue><Parameters><Parameter Name="x" Type="T" /><Parameter Name="y" Type="T" /></Parameters><Docs><param name="x">First <see langword="T" /> to compare.</param><param name="y">Second <see langword="T" /> to compare.</param><summary><para>Determines whether the specified objects are equal.</para></summary><returns><para><see langword="true" /> if the specified objects are equal; otherwise, <see langword="false" />.</para></returns><remarks><para>An implementation of Equals(T,T) shall satisfy the following: The equality function shall be be reflexive, so x.Equals(x) is true; symmetric, so x.Equals(y) and y.Equals(x); and transitive, so x.Equals(y)  and
y.Equals(z) implies x.Equals(z); for any values x, y and z for  which these expressions are defined.</para></remarks><since version=".NET 2.0" /></Docs></Member><Member MemberName="GetHashCode"><MemberSignature Language="C#" Value="public int GetHashCode (T obj);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance int32 GetHashCode(!T obj) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Int32</ReturnType></ReturnValue><Parameters><Parameter Name="obj" Type="T" /></Parameters><Docs><param name="obj">The object for which the hash code is to be returned.</param><summary><para>Returns a hash code for the specified object.</para></summary><returns><para>A hash code for the specified object.</para></returns><remarks><para>To produce a hash function for the given object. <block subset="none" type="note"> A hash function is used to
   quickly generate a number (a hash code) corresponding to the value of an object.
   Hash functions are used with <see langword="hashtables" />. A good hash function
   algorithm rarely generates hash codes that collide. For more information about
   hash functions, see <paramref name="The Art of Computer Programming" />
   
   , Vol. 3, by Donald E. Knuth.</block></para><block subset="none" type="behaviors"><para>All implementations are required to ensure that if x.Equals(y) ==  true, then x.GetHashCode() equals y.GetHashCode(), for any x and y values for which these expressions are defined.</para></block></remarks><since version=".NET 2.0" /><exception cref="T:System.ArgumentNullException">The type of <paramref name="obj" /> is a reference type and <paramref name="obj" /> is <see langword="null" />.</exception></Docs></Member></Members></Type>