Configuration file in VS2008 App. Config Simple summary

Source: Internet
Author: User

The application's configuration file is used to read and save simple local data, and the new profile in VS can be added directly to the project's "Properties"-"settings". After adding a set of two files in the Properties folder of the project: Settings.settings and Settings.Designer.cs, the former is an XML file for the VS interface display, the latter is a vs generated inherited System.configuratio The class Settingof N.applicationsettingsbase, which is strongly typed, makes it easy to read and save configuration items through code:

Alternatively, you can right-click Project-Add-new item-General-settings file Add (note that it is not an application configuration file). In this case, a project may have multiple sets of settings files, vs will automatically generate an app. config merge multiple sets of configuration items.

Then, in the program can use the properties. Settings. The Default.test1 property reads the settings through its Settings. The Save method saves the settings after the project is generated in the program directory according to app. exe.config's configuration file.

It is important to note that the type of configuration item is divided into "user" and "application", the former refers to each logged-on Windows user has a copy, the file changes will not affect other users, so the type of "user" configuration node is saved in C:\Users\bb\AppData\ Local\microsoft\ Program Name directory, and a number of different versions corresponding to different configuration files, and program directory program name. The corresponding configuration item for exe.config is not working.

The type "Application" is globally valid for the system, and its configuration items are stored in the program name under the program directory. exe.config, in the code, the properties. Settings. Default.test2 This "application" configuration item is read-only and cannot be written.

Configuration file in VS2008 App. Config Simple summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.