|
-
July 7th, 2011, 03:28 AM
#3
Re: References and copying objects
//Is this.Title a new string? or referencing the same string as copy.Title?
This is the same object reference. The exact same string. As strings are immutable, this is fine.
//is this a deep copy or not?
_variables = new Dictionary<String, Variable>(copy._variables);
Check the documentation for this constructor. You'll find that it copies all the elements from the dictionary you pass in. i.e. the two dictionaries are physically different, but they contain the exact same objects as their keys and values.
www.monotorrent.com For all your .NET bittorrent needs
NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|