public static void SetValue(string key, string value)
        {
            string file = System.Windows.Forms.Application.ExecutablePath;

            Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap
            {
                ExeConfigFilename = file + ".config"
            }, ConfigurationUserLevel.None);
            configuration.AppSettings.Settings[key].Value = value;
            configuration.Save();
        }

 配置文件刷新

ConfigurationManager.RefreshSection("appSettings");

 

相关文章:

  • 2022-12-23
  • 2021-11-09
  • 2021-11-06
  • 2021-10-30
  • 2021-07-06
  • 2021-07-18
  • 2022-12-23
猜你喜欢
  • 2021-08-30
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2021-11-16
  • 2021-11-27
相关资源
相似解决方案