Created
December 26, 2016 17:07
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeClass { | |
public string someField; | |
} | |
var instance1 = new SomeClass(); // instance1 is a reference to an object in memory | |
var instance2 = instance1; // instance2 is a copy of the reference | |
instance2.someField = "changed"; | |
instance1.someField == instace2.someField // -> true | |
instace2 = new SomeClass(); | |
instance2.someField = "changed again"; | |
instance1.someField != instance2.someField // -> true -> they are different objects | |
instance1.someField; // -> "changed" -> nothing changed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment