Determines whether the specified Object is the same instance as the current Object. Subclasses are expected to override this method to support value equality (not reference equality).
[Visual Basic] Overridable Public Function Equals( _ ByVal obj As Object _ ) As Boolean [C#] public virtual bool Equals( object obj ); [C++] public: virtual bool Equals( Object* obj ); [JScript] public function Equals( obj : Object ) : Boolean;
true if the specified Object is the same instance as the current Object; otherwise, false.
For reference types, equality is defined as object equality; that is, whether the references refer to the same object. For value types, equality is defined as bitwise equality. The ValueType class supports value types.
Notes to Implementers:
This method can be overridden by a derived class. For example, many of the base data types return true if both objects represent the same value; false otherwise.
This method only compares primitives and objects. It must be overridden to compare more complex structures, such as arrays of objects.
Implementations of this method must obey the following:
Managed C++:
Object *Obj1 = new Object(); Object *Obj2 = new Object(); Console::WriteLine(Obj1->Equals(Obj2)); //===> false Obj2 = Obj1; Console::WriteLine(Obj1->Equals(Obj2)); //===> true