Class ReferenceEqualityComparer<T>
A Comparator to use ReferenceEquals(object, object) method.
public class ReferenceEqualityComparer<T> : EqualityComparer<T>, IEqualityComparer<T>, IEqualityComparer where T : class
Type Parameters
T
Type of the comparer
- Inheritance
-
ReferenceEqualityComparer<T>
- Implements
- Inherited Members
Properties
Default
Gets the default.
public static IEqualityComparer<T> Default { get; }
Property Value
Methods
Equals(T, T)
When overridden in a derived class, determines whether two objects of type T
are equal.
public override bool Equals(T x, T y)
Parameters
x
TThe first object to compare.
y
TThe second object to compare.
Returns
GetHashCode(T)
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.
public override int GetHashCode(T obj)
Parameters
obj
TThe object for which to get a hash code.
Returns
- int
A hash code for the specified object.
Exceptions
- ArgumentNullException
The type of
obj
is a reference type andobj
is null.