.NET winform App.config配置文件 字段的CRUD

////讀取
string temptimeStart=ConfigurationManager.AppSettings[""];
//修改
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings[""].Value = "";
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");

編程時操作在app.config文件中,看到此文件中的key的value沒有變化。

實際使用中數據保存在程序根目錄下的exe.config文件中,不影響實際使用。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章