I think a number of other answers missed something.
In the case of object.ReferenceEquals(object,object)
any types of values ββare "placed" in objects, and these (new) objects are passed. Consider the following:
DateTime d1 = DateTime.MinValue; DateTime d2 = d1; object ob1 = (object)d1; // boxed! object ob2 = ob1; // false - the values in d1 and d2 are BOXED to (new) different objects object.ReferenceEquals(d1, d2); // false - same as above, although I am not sure sure if a // VM implementation could re-use a BOXED object object.ReferenceEquals(d1, d1); // true - naturally - BOXED only once at "boxed!" (same object!) object.ReferenceEquals(ob1, ob2);
Happy coding.
Related: Marc responds to a Vs Reference Type - Object Class C # Value Type , where it talks about box conversion .
user166390
source share