Determines whether two object references are identical.
- objA
- Documentation for this section has not yet been entered.
- objB
- Documentation for this section has not yet been entered.
True if a and b refer to the same object or are both null references; otherwise, false.
This static method provides a way to compare two objects for reference equality. It does not call any user-defined code, including overrides of object.Equals(object) .
C# Example
using System; class MyClass { static void Main() { object o = null; object p = null; object q = new Object(); Console.WriteLine(Object.ReferenceEquals(o, p)); p = q; Console.WriteLine(Object.ReferenceEquals(p, q)); Console.WriteLine(Object.ReferenceEquals(o, p)); } }The output is
True
True
False
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0