I have a List<T> and I do the following:
var myObj = List[2]; //Return object at position 2
myObj.Name = "fred"; //If you look at List[2] its name has changed to fred
I tried the following but it still updates the item in the List
var newObj = new MyObj();
var myObj = List[2]; //Return object at position 2
newObj = myObj;
newObj.Name = "fred"; //If you look at List[2] its name has still changed to fred
How can I avoid this pointer remaining so I can update properties without it updating it in the list?
Great comments, thanks but this is what I have implemented: