By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

Deep copy alternatives

P: n/a
Hi there,

In my application I have a Settings class which has two objects,
userSettings and defaultSettings. When the application starts, I use a
deep copy to set-up userSettings with the values found in
defaultSettings. This was an akward process, as the Settings class
contains many Lists, some of which contain Lists themselves, and so
on. As the program executes, the userSettings object is updated. Then
when the program is exited, I use a deep comparison of my two objects
to check if their constituent values are equal. If not, the user is
asked to save their own version of the settings.

Is this a good approach and if not, how would you go about doing this?
I took some time to write the deep functions and I have yet to test
them fully. A lazy, but less bug prone approach perhaps to the deep
copy issue would be to deserialize defaultSettings and serialize the
result to userSettings...

Thanks for your help,

Barry.

Apr 18 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In my application I have a Settings class which has two objects,
userSettings and defaultSettings. When the application starts, I use a
deep copy to set-up userSettings with the values found in
defaultSettings. This was an akward process, as the Settings class
contains many Lists, some of which contain Lists themselves, and so
on. As the program executes, the userSettings object is updated. Then
when the program is exited, I use a deep comparison of my two objects
to check if their constituent values are equal. If not, the user is
asked to save their own version of the settings.

Is this a good approach and if not, how would you go about doing this?
I took some time to write the deep functions and I have yet to test
them fully. A lazy, but less bug prone approach perhaps to the deep
copy issue would be to deserialize defaultSettings and serialize the
result to userSettings...
Are you rolling your own or relying on strongly-typed settings which are
easily set up in the (VS 2005) IDE (all based on the
"ApplicationSettingsBase" class). Right click your project's name in
Solutions Explorer, select "Properties" and click the "Settings" tab on the
left. There's a link at the top called "Learn more about application
settings" to get you started. Also see the following MSFT blog. I've dealt
with the author before and he's very experienced.

http://blogs.msdn.com/rprabhu/articles/433979.aspx
Apr 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.