I'm using C# .NET.
In my software I'm providing settings dialog through which user can set the application settings which I want to save to a file.
Requirements (typical):
- Every class I defined uses some part of these settings. So, these should be global to all classes.
- These should be loaded while software is started.
- When ever user changes settings and clicks 'save'/'apply'. Current settings should change.
I am wondering what is the best way to do this? Also, what is the best way to save these settings to disk? I mean should I create a Settings
class object and serializing it to 'settings.dat' or provide an structured file like XML/JSON
This is required for almost every other software. So, isn't there any design pattern for this?
EDIT:
Well, thats something that I didn't know. Its nice :). But say while user is using the software in the middle he changes the settings then all the other objects that are using these global Properties.Settings.Default.* should be changed. Is there any kind of notification mechanism? Some kind of event?