ReferenceEqualityComparer 类

定义

IEqualityComparer<T> ReferenceEquals(Object, Object) Equals(Object) 在比较两个对象实例时,使用引用相等性 () 而不是值相等性 () 。An IEqualityComparer<T> that uses reference equality (ReferenceEquals(Object, Object)) instead of value equality (Equals(Object)) when comparing two object instances.

public ref class ReferenceEqualityComparer sealed : System::Collections::Generic::IEqualityComparer<System::Object ^>, System::Collections::IEqualityComparer
public sealed class ReferenceEqualityComparer : System.Collections.Generic.IEqualityComparer<object>, System.Collections.IEqualityComparer
type ReferenceEqualityComparer = class
    interface IEqualityComparer<obj>
    interface IEqualityComparer
Public NotInheritable Class ReferenceEqualityComparer
Implements IEqualityComparer, IEqualityComparer(Of Object)
继承
ReferenceEqualityComparer
实现

注解

ReferenceEqualityComparer类型不能实例化。The ReferenceEqualityComparer type cannot be instantiated. Instance 为使用属性访问此类型的单一实例。Instead, use the Instance property to access the singleton instance of this type.

属性

Instance

获取单一 ReferenceEqualityComparer 实例。Gets the singleton ReferenceEqualityComparer instance.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
Equals(Object, Object)

确定两个对象引用是否引用同一对象实例。Determines whether two object references refer to the same object instance.

GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetHashCode(Object)

返回指定对象的哈希代码。Returns a hash code for the specified object. 返回的哈希代码基于对象标识,而不是对象的内容。The returned hash code is based on the object identity, not on the contents of the object.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于