开发者

What is the difference between an "Application Configuration File" & "Settings File" in C#?

开发者 https://www.devze.com 2023-01-12 18:23 出处:网络
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.

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!

What is the difference between an "Application Configuration File" & "Settings File" in C#?

What is the difference between an "Application Configuration File" & "Settings File" in C#?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号