using System; namespace System.Collections.Generic { /// Provides a base class for implementations of the generic interface. /// The type of objects to compare. // Token: 0x02000106 RID: 262 [Serializable] public abstract class EqualityComparer : IEqualityComparer, IEqualityComparer { // Token: 0x06000CE8 RID: 3304 RVA: 0x00039D18 File Offset: 0x00037F18 static EqualityComparer() { if (typeof(IEquatable).IsAssignableFrom(typeof(T))) { EqualityComparer._default = (EqualityComparer)Activator.CreateInstance(typeof(GenericEqualityComparer<>).MakeGenericType(new Type[] { typeof(T) })); } else { EqualityComparer._default = new EqualityComparer.DefaultComparer(); } } /// Returns a hash code for the specified object. /// A hash code for the specified object. /// The for which a hash code is to be returned. /// The type of is a reference type and is null.-or- is of a type that cannot be cast to type . // Token: 0x06000CE9 RID: 3305 RVA: 0x00039D84 File Offset: 0x00037F84 int IEqualityComparer.GetHashCode(object obj) { return this.GetHashCode((T)((object)obj)); } /// Determines whether the specified objects are equal. /// true if the specified objects are equal; otherwise, false. /// The first object to compare. /// The second object to compare. /// /// or is of a type that cannot be cast to type . // Token: 0x06000CEA RID: 3306 RVA: 0x00039D94 File Offset: 0x00037F94 bool IEqualityComparer.Equals(object x, object y) { return this.Equals((T)((object)x), (T)((object)y)); } /// When overridden in a derived class, serves as a hash function for the specified object for hashing algorithms and data structures, such as a hash table. /// A hash code for the specified object. /// The object for which to get a hash code. /// The type of is a reference type and is null. // Token: 0x06000CEB RID: 3307 public abstract int GetHashCode(T obj); /// When overridden in a derived class, determines whether two objects of type are equal. /// true if the specified objects are equal; otherwise, false. /// The first object to compare. /// The second object to compare. // Token: 0x06000CEC RID: 3308 public abstract bool Equals(T x, T y); /// Returns a default equality comparer for the type specified by the generic argument. /// The default instance of the class for type . // Token: 0x170001EE RID: 494 // (get) Token: 0x06000CED RID: 3309 RVA: 0x00039DA8 File Offset: 0x00037FA8 public static EqualityComparer Default { get { return EqualityComparer._default; } } // Token: 0x0400037B RID: 891 private static readonly EqualityComparer _default; // Token: 0x02000107 RID: 263 [Serializable] private sealed class DefaultComparer : EqualityComparer { // Token: 0x06000CEF RID: 3311 RVA: 0x00039DB8 File Offset: 0x00037FB8 public override int GetHashCode(T obj) { if (obj == null) { return 0; } return obj.GetHashCode(); } // Token: 0x06000CF0 RID: 3312 RVA: 0x00039DD4 File Offset: 0x00037FD4 public override bool Equals(T x, T y) { if (x == null) { return y == null; } return x.Equals(y); } } } }