I wasn’t sure about this but I find this interesting:
object x = 7; object y = 7; Console.WriteLine(object.ReferenceEquals(x, x)); Console.WriteLine(object.ReferenceEquals(x, y));
Of course this is because we’re assigning the ints to objects, so they become boxed. This could be very useful to me…
This actually works well except for the case of strings. They are already reference types and apparently they are special cased in .net such that there is always only a single instance of a partictular string.
You must log in to post a comment.