ReferenceEqualityComparer<T> Class

Namespace
Kampute.DocToolkit.Collections
Assembly
  • Kampute.DocToolkit.dll

Definition

Provides an equality comparer that uses reference equality (object.ReferenceEquals(object, object)) instead of value equality.
public sealed class ReferenceEqualityComparer<T> : IEqualityComparer<T>
	where T : class
Inheritance
  • object
  • ReferenceEqualityComparer<T>
Implements

Type Parameters

T
The type of objects to compare.

Remarks

This comparer determines equality based on object identity rather than content. Two object references are considered equal only if they refer to the same instance in memory.

Hash codes are computed using RuntimeHelpers.GetHashCode(object), which returns an identity-based hash code rather than a content-based one.

Properties

InstanceGets the singleton instance of ReferenceEqualityComparer<T>.

Methods

Equals(T, T)Determines whether two object references refer to the same instance.
GetHashCode(T)Returns an identity-based hash code for the specified object.