看到网上的读写app.config的代码,说是写的时候不能直接用System.Configuration.ConfigurationSettings.AppSettings.Set(AppKey, AppValue),而要把app.config当作XML文件来写。试了下确实如此,那这个Set()方法提供来是干嘛的?源代码的SelectSingleNode()里写的XPath有问题,就随带看了点XPath基础,修改后如下:

Win Form 项目中app.config读取和修改 [ZT]        //读 Config
Win Form 项目中app.config读取和修改 [ZT]
        public static string GetCfgValue(string AppKey)
        }

PS:估计app.config是在程序启动时就载入的,修改后的值要重新运行程序后才能读到。

相关文章:

  • 2021-12-28
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2021-11-12
猜你喜欢
  • 2021-10-03
  • 2021-09-07
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
相关资源
相似解决方案