.net - How do I copy the content of a dictionary to an new dictionary in C#? -
how can copy dictionary<string, string>
new dictionary<string, string>
not same object?
assuming mean want them individual objects, , not references same object:
dictionary<string, string> d = new dictionary<string, string>(); dictionary<string, string> d2 = new dictionary<string, string>(d);
"so dont same object."
ambiguity abound - if want them references same object:
dictionary<string, string> d = new dictionary<string, string>(); dictionary<string, string> d2 = d;
(changing either d
or d2
after above affect both)
Comments
Post a Comment