This blog will cover the use of settings in C #.
First of all, a desktop program in the example, when we install a new software, the software will be launched after the launch of a form such as a novice guide to pop out, each time you need to close it. Of course, these software will provide functions such as no longer display. When you choose no longer to display features, these forms will no longer show up later.
For these settings, you can use some of the following methods to store, customize the XML file, the registry, and, of course, the settings file that comes with C #. It is recommended to use the settings file. The registry is not easy to use, and custom XML needs to be parsed when it is used, and can be an alternative.
Here is an example to show
Create a new WPF project,
The blue background is settings,
A setting has 4 attribute name,type,scope,value. Focusing on the scope property, the scope property has two values of application,user. The difference is that when the scope value is application, the corresponding setting cannot be modified at run time. When the scope value is user, the corresponding setting can be modified at run time.
Setting save location: When the program compiles, the value of setting is saved in the <assemblyname>.exe.config file, for example:
Using setting in your program,
// Modify The setting value false ; // Save Setting Value Properties.Settings.Default.Save ();
Here settings the relevant content is finished.
Thank you for reading, code click here to download.
C # Settings Usage Summary