If you had value types to start with, you are correct. Here is the difference...
int iOne = 1;
int iTwo = 2;
object one = iOne;
object two = iTwo;
In this case, you have created two value types (iOne
and iTwo
, which you then assign to object variables. At the point of the assignment, the runtime is boxing the value types to reference types. However, in your case you have
object one = 1;
object two = 2;
Which is not the same. Here you are assigning the literal values to the object variables, which don't create any value types.
Scott Dorman
Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai