How to change the value in List<T> list2 without changing the value in List<T> list1 when using list1.AddRange(list2)?

71 Views Asked by At

My code

list1.AddRange(list2);
foreach (var item in list2)
{
    item.Value--;
}

when I change the value in list2, the values added to list1 before are also changed

how can the value in list1 not be changed?

0

There are 0 best solutions below