Equals Method (Object, Object)

[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 considered equal.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared Function Equals ( _
    objA As Object, _
    objB As Object _
) As Boolean
public static bool Equals(
    Object objA,
    Object objB
)
public:
static bool Equals(
    Object^ objA, 
    Object^ objB
)
static member Equals : 
        objA:Object * 
        objB:Object -> bool 
public static function Equals(
    objA : Object, 
    objB : Object
) : boolean

Parameters

Return Value

Type: System. . :: . .Boolean
true if the objects are considered equal; otherwise, false. If both objA and objB are null, the method returns true.

Remarks

The static Equals(Object, Object) method indicates whether two objects, objA and objB, are equal. It also enables you to test objects whose value is null for equality. It compares objA and objB for equality as follows:

  • It determines whether the two objects represent the same object reference. If they do, the method returns true. This test is equivalent to calling the ReferenceEquals method. In addition, if both objA and objB are null, the method returns true.

  • It determines whether either objA or objB is null. If so, it returns false.

  • If the two objects do not represent the same object reference and neither is null, it calls objA.Equals(objB) and returns the result. This means that if objA overrides the Equals(Object) method, this override is called.

.NET Framework Security

See Also

Reference

Object Class

Equals Overload

System Namespace