Possible Duplicate:
What is the best way to clone/deep copy a .NET generic Dictionary<string, T>?
Hi there! I stuck on something and I really need help :( So I have a dictionary
Dictionary<string, MyClass> dict = new Dictionary<string, MyClass>();
Where MyClass is some class with properties, methods and so on. When I try to copy this dictionary to another, for instance:
Dictionary<string, MyClass> newDict = new Dictionary<string, MyClass>(dict);
It seems that the data is copied by reference and when I try to update any MyClass object in the newDict, the data is updated and in dict. So how can I copy one dictionary to another and when I try to update the data in the copy, the data in the original stays the same?
Thanks in advance :) Have a nice day :)