1、在App.config我们添加appSettings节点,然后在appSettings里面在添加配置信息
2、添加System.Configuration引用
3、操作App.config;
操作前先在对应的类里引用命名空间:using System.Configuration;
3.1:读取数据
string ServiceUrl = ConfigurationManager.AppSettings["CheckUpdatesUrl"];
3.2:修改数据
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
cfa.AppSettings.Settings["CheckUpdatesUrl"].Value ="xxxx";
cfa.Save(ConfigurationSaveMode.Modified);