配置文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key ="Data Source" value ="Data Source=ca.db;"/>
</appSettings>
</configuration>
我在类里面使用下面语句获取,但返回值是Null。
另外测试了更新提示空值出错,应该是未读取到文档
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
cfa.AppSettings.Settings["Data Source"].Value = "db.db";
cfa.Save();
ConfigurationManager.RefreshSection("appSettings");
应该如何添加配置文件,并可以进行读写?