Class ReferenceEqualityComparer<T>
An equality comparer based exclusively on object reference, even if the object has implemented IEquatable or overrides the default Equals method.
Inheritance
System.Object
ReferenceEqualityComparer<T>
Implements
System.Collections.Generic.IEqualityComparer<T>
Namespace: System.Linq.CompilerServices
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public class ReferenceEqualityComparer<T> : Object, IEqualityComparer<T> where T : class
Type Parameters
Name | Description |
---|---|
T | The reference type. |
Properties
Instance
The instance of the equality comparer.
Declaration
public static ReferenceEqualityComparer<T> Instance { get; }
Property Value
Type | Description |
---|---|
ReferenceEqualityComparer<T> |
Methods
Equals(T, T)
Checks if two objects are reference equal.
Declaration
public bool Equals(T x, T y)
Parameters
Type | Name | Description |
---|---|---|
T | x | The left object. |
T | y | The right object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are reference equal, false otherwise. |
GetHashCode(T)
Gets a unique hash code based on the object reference.
Declaration
public int GetHashCode(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The object. |
Returns
Type | Description |
---|---|
System.Int32 | The reference-based hash code. |
Implements
System.Collections.Generic.IEqualityComparer<>