配置文件刷新问题

swatsniper1985 swatsniper1985 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
private void SetConfiguration(string Appkey, string AppValue) {
XmlDocument doc = new XmlDocument();

doc.Load(Application.ExecutablePath + ".config");

XmlNode xNode;
XmlElement xElement;

xNode = doc.SelectSingleNode("//appSettings");

xElement = (XmlElement)xNode.SelectSingleNode("//add[@key='" + Appkey + "']");
xElement.SetAttribute("value", AppValue);

doc.Save(Application.ExecutablePath + ".config");
Close();
}
我写了个修改配置文件的方法,但是有个问题,假如我不退出当前应用程序的话,读取到的值仍旧是修改前的值,请问如何解决
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
swatsniper1985
C# 111,129 成员 642,540 内容