I know this Questions is asked and has answer already here: C# how to assign List<T> without being a reference?
but as @Dev said it is still being referenced. my "name_list1
" is static and then I am coping like:
name_list2 = new List<string>(name_list1);
as answered in above link. i have tried all possible solution founded from stackoverflow like:
using - AddRange
, ToList
, ToArray
and all. but still it is creating ref only to name_list1
. as I am changing object value in name_list2
it is affected in name_list1
too.
I needed to ask this Question again as I am not able to comment on others question due to <50 reputation :P :(