I've worked a little with *.config files in the past, but I've not uses Settings files at all. Simply put, what's the difference between a project's Settings file and *.config file? Are there conventions as to what information goes in which? When should one be used over the other? How are Settings files built - are they embedded into the assembly, or kept external like *.config files?
-
Not much when you look at where the data is stored..
Settings gives you- a GUI (In the Project Properties window) to create key-value pairs as opposed to manually tweaking the app.config
- a designer generated type safe class to access key-value pairs.
- It also makes a distinction between application-level and user-level settings.
Internally the key-value pairs are stored in a section in the app.config itself. Settings gives you a better API to deal with this problem and hence should be preferred to read-write to the app.config file.
Create a settings file in your project and then double click the corresponding app.config file. You should see your settings within an applicationSettings/userSettings node.
-
A project's settings file drives part the .config. Kind of.
If you add settings you will see that a custom configuration section is created in your configuration file. Instead of specifying ConfigurationSettings.Application("myKey") the settings file is used to autogenerate a strongly typed class which exposes your settings as properties, but the actual settings are still held in the configuration file.
However one difference is user settings (for certain project types). These you can set as well as get and persist them into the user's local profile directory without having to write those bits yourself.
0 comments:
Post a Comment