/// <summary> /// 更新配置文件信息 /// </summary> /// <param name="name">配置文件字段名称</param> /// <param name="Xvalue">值</param> public void UpdateConfig(string name, string Xvalue) { Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); cfa.AppSettings.Settings[name].Value = Xvalue; cfa.Save(); System.Configuration.ConfigurationManager.RefreshSection("appSettings"); } /// <summary> /// 读取配置文件信息 /// </summary> /// <param name="name"></param> /// <returns></returns> public string GetConfig(string name) { return System.Configuration.ConfigurationManager.AppSettings[name]; }