Hi,
I have a list of objects (List1) and I am trying to make a copy of this list (List2) and then change one of the fields in the new list.
I used :
List<MyObj> List2 = new List<MyObj>();
List2.AddRange(List1);
I alos tried:
List<MyObj> List2 = new List<MyObj>(List1);
But regardless of the method, when I do:
foreach (MyObj o in List2)
o.some_field = 2
it not only changes the field in Lis2 but alos in List1. Not sure what I am missing here.
...
Go to the complete details ...