What is the difference between an "Application Configuration File" & "Settings File" in C#?
What is the purpose of having two files that appear to do the same/开发者_运维技巧similar thing? Is one deprecated and should I be using the other? Please, break it down for me.
Thanks!
Check Settings file -v- app.config.
Implementation.
An application can provide an interface for the user to edit/modify setting that can be persisted. There is no API to write to app.config and nothing to re-load it should it be changed at run-time. Thus, Settings were created. They provide one place to hold application and user settings. User settings default values are stored in app.config that the user can edit before the application is run; but should the application provide an interface to edit/modify certain settings they can be persisted back to disk to a user.settings file local to the user allowing users to have independent and secure setting values
The first one stores application specific settings (global) and the second one stores setting per user.
An application configuration file is meant to go in your application's working directory as .exe.config. A settings file goes in the application data path to store settings. Typically, you use a Settings file for user-level settings that are different for each user running it and don't require elevated privileges to modify.
精彩评论