.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

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -