This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16815|Reply: 0

[WPF] WPF reads and writes config files

[Copy link]
Posted on 12/16/2015 3:26:47 PM | | |
WPF read/write config file sheet.
1. In your project, add the app.config file. The contents of the file default are:

2. If you want to configure some parameters for the program, <configuration>add them in the tag<appSettings>. For example, the following:
3. Then you can read and write it where you need it in the background program. Remember to add citations

using System.Configuration;
4. Read operation:

string strPath = ConfigurationManager.AppSettings["Path"];
5. Write Operations:

Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
cfa. AppSettings.Settings["NAME"]. Value = "WANGLICHAO";
cfa. Save();





Previous:The definition of the segment is a reference
Next:net uses the HttpListener listening port
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com