Change values of list in list<list>

Aug 22 2016 2:44 PM
Hello all. I have the code in c#
List<int> lst = new List<int>() { 1, 2, 3, 4, 5, 6 };
List<List<int>> l1 = new List<List<int>>();
l1.Add(lst);
result in l1: 1 2 3 4 5 6
lst[1] = 10;
result in l1: 1 10 3 4 5 6
i want when change value of lst example. lst[1] = 10, elements of l1 do not change.
example when change value  lst[1] = 10, result in l1: 1 2 3 4 5 6
How do it??? Thanks all!

Answers (2)