.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

Popular posts from this blog

haskell - Using filter on an item in a list? -

c# - When does PreApplicationStartMethod actually get triggered to run? -

tomcat6 - Exception when stopping container for a with Spring + Quartz + Tomcat web application -