When is a C# value/object copied and when is its reference copied?
I keep getting the same issue over and over again where an object I want to reference is copied or where an object I want to copy is referenced. This happens when I use the = operator. For example, if I am sending the object to another form, ie: SomeForm myForm = new SomeForm(); SomeObject myObject = new SomeObject(); myForm.formObject = myObject; ...and then modify the object in the form, the original object does not get modified. It is as if the object was copied and not referenced. Yet, when I do this: SomeObject myObject = new SomeObject(); SomeObject anotherObject = new SomeObject();