Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Determines whether the specified Object instances are the same instance.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared Function ReferenceEquals ( _
objA As Object, _
objB As Object _
) As Boolean
public static bool ReferenceEquals(
Object objA,
Object objB
)
public:
static bool ReferenceEquals(
Object^ objA,
Object^ objB
)
static member ReferenceEquals :
objA:Object *
objB:Object -> bool
public static function ReferenceEquals(
objA : Object,
objB : Object
) : boolean
Parameters
- objA
Type: System. . :: . .Object
The first object to compare.
- objB
Type: System. . :: . .Object
The second object to compare.
Return Value
Type: System. . :: . .Boolean
true if objA is the same instance as objB or if both are null; otherwise, false.
Remarks
Unlike the Equals method and the equality operator, the ReferenceEquals method cannot be overridden. Because of this, if you want to test two object references for equality and are unsure about the implementation of the Equals method, you can call the ReferenceEquals method. However, note that if objA and objB are value types, they are boxed before they are passed to the ReferenceEquals method.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.