日期:2014-05-17  浏览次数:20728 次

C# 读取配置文件和修改

读取:

string str= ConfigurationManager.AppSettings["key"];
?

写入:

?Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
?configuration.AppSettings.Settings[key].Value = result;
configuration.Save();
ConfigurationManager.RefreshSection("appSettings");