Click here to Skip to main content
15,921,622 members
Home / Discussions / C#
   

C#

 
QuestionCopying objects by value Pin
jozsurf16-Jul-07 17:59
jozsurf16-Jul-07 17:59 
AnswerRe: Copying objects by value Pin
originSH16-Jul-07 22:09
originSH16-Jul-07 22:09 
AnswerRe: Copying objects by value Pin
Luc Pattyn16-Jul-07 22:47
sitebuilderLuc Pattyn16-Jul-07 22:47 
GeneralRe: Copying objects by value Pin
jozsurf16-Jul-07 23:42
jozsurf16-Jul-07 23:42 
GeneralRe: Copying objects by value Pin
Luc Pattyn17-Jul-07 0:20
sitebuilderLuc Pattyn17-Jul-07 0:20 
GeneralRe: Copying objects by value Pin
jozsurf17-Jul-07 15:06
jozsurf17-Jul-07 15:06 
GeneralRe: Copying objects by value Pin
Luc Pattyn17-Jul-07 16:45
sitebuilderLuc Pattyn17-Jul-07 16:45 
GeneralRe: Copying objects by value Pin
jozsurf17-Jul-07 16:59
jozsurf17-Jul-07 16:59 
Thanks for your reply, Luc. I wasn't aware of the Clone method and I'm afraid that I've probably reinvented the wheel by introducing a Copy method.

1. the settings (either actual, or default) are stored in a class (SettingsClass) ?
Yes.
2. you need at least two instances of it, one for defaults, one for actuals ?
Yes. As we want to be able to revert back to the default settings at any time.
3. a ref to both instances, and a lot of other stuff, are stored in SavedData ?
Correct.
4. you want to be able to modify the default settings ?
Nope.
5. where did you obtain the default settings ? I guess from a file ? XML ?
It's actually hardcoded in the setting class default constructor.
6. are you going to save everything (all of SavedData) at once and in one location ?
Yes the 'current' version of SavedData is written to an XML file at the end of the session. The default version of SavedData is simply recreated at the start of each session.
7. if default settings can be changed, what is the meaning of settings ?
8. is SettingsClass just a list of value types, or does it also contain references
(e.g. strings) ?
Just value types (primitive types and structs). Funny you should mention strings there, although I think my confusion with strings is to do with the fact that strings behave like value types sometimes (i.e. with the "=" operator and the .Equals() method)
9. do you need more than one clone ? I would expect it contains all settings, so you
start of with the defaults, copy once, then modify at will, but your message seems
to suggest you often need a copy ??
Well I may need to copy it many times i.e. the user may choose to revert to default, change something, revert back to default, change something, revert back to default...ad infinitum. So my local copy may be one of three values: a modified version, the default version or the saved version but it has to be independent of the default and saved references.

Hope I understood your questions correctly.


GeneralRe: Copying objects by value [modified] Pin
Luc Pattyn17-Jul-07 17:15
sitebuilderLuc Pattyn17-Jul-07 17:15 
GeneralRe: Copying objects by value Pin
jozsurf17-Jul-07 18:07
jozsurf17-Jul-07 18:07 
GeneralRe: Copying objects by value Pin
Luc Pattyn22-Jul-07 12:00
sitebuilderLuc Pattyn22-Jul-07 12:00 
QuestionHow to set and get Windows Application's Version? Pin
Khoramdin16-Jul-07 17:21
Khoramdin16-Jul-07 17:21 
AnswerRe: How to set and get Windows Application's Version? Pin
Vikram A Punathambekar16-Jul-07 17:40
Vikram A Punathambekar16-Jul-07 17:40 
QuestionRe: How to set and get Windows Application's Version? Pin
Khoramdin16-Jul-07 19:20
Khoramdin16-Jul-07 19:20 
AnswerRe: How to set and get Windows Application's Version? Pin
Vikram A Punathambekar16-Jul-07 21:05
Vikram A Punathambekar16-Jul-07 21:05 
AnswerRe: How to set and get Windows Application's Version? Pin
originSH16-Jul-07 22:14
originSH16-Jul-07 22:14 
AnswerRe: How to set and get Windows Application's Version? Pin
ekynox17-Jul-07 13:33
ekynox17-Jul-07 13:33 
QuestionDataGrid date AND time Column[modified] Pin
swjam16-Jul-07 14:24
swjam16-Jul-07 14:24 
AnswerRe: DataGrid date AND time Column[modified] Pin
Michael Sync16-Jul-07 17:39
Michael Sync16-Jul-07 17:39 
GeneralRe: DataGrid date AND time Column[modified] Pin
swjam16-Jul-07 20:59
swjam16-Jul-07 20:59 
GeneralRe: DataGrid date AND time Column[modified] Pin
Rhys Gravell16-Jul-07 23:09
professionalRhys Gravell16-Jul-07 23:09 
Questionadd a page Pin
daku116-Jul-07 12:47
daku116-Jul-07 12:47 
AnswerRe: add a page Pin
T.EDY16-Jul-07 17:06
T.EDY16-Jul-07 17:06 
AnswerRe: add a page Pin
Sathesh Sakthivel16-Jul-07 17:20
Sathesh Sakthivel16-Jul-07 17:20 
Questionthrow exception does not work in timer event??? Pin
Togg16-Jul-07 12:38
Togg16-Jul-07 12:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.