I\'d like to know what is default implementation for equality operatort (== and !=)
Is it?
public static bool operator ==(object obj1, object obj2)
{
The C# language specification, Section 7.9 covers the exact behavior of the built-in ==
operator. For example, when using ==
on reference-type values, the following section applies:
7.9.6 Reference type equality operators
The predefined reference type equality operators are:
bool operator ==(object x, object y);
bool operator !=(object x, object y);
The operators return the result of comparing the two references for equality or non-equality.
Since the predefined reference type equality operators accept operands of type object, they apply to all types that do not declare applicable operator == and operator != members. Conversely, any applicable user-defined equality operators effectively hide the predefined reference type equality operators.
[More details skipped...]
Note that "comparing two references for equality" does not mean "the result of calling obj1.Equals(obj2)
". It means that both references must point to the same object (reference equality).