关于winform的appconfig的读写操作

关于winform的appconfig的读写操作
 public string ReadConfig()
        {
            List<string> list = new List<string>();
            ExeConfigurationFileMap file = new ExeConfigurationFileMap();
            file.ExeConfigFilename = System.Windows.Forms.Application.ExecutablePath + ".config";
            Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(file, ConfigurationUserLevel.None);

            var myApp = (AppSettingsSection)config.GetSection("appSettings");
            return myApp.Settings["lcc"].Value;
     
        }

        public string WriteConfig(string val)
        {
            ExeConfigurationFileMap file = new ExeConfigurationFileMap();
            file.ExeConfigFilename = System.Windows.Forms.Application.ExecutablePath + ".config";
            Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(file, ConfigurationUserLevel.None);

            var myApp = (AppSettingsSection)config.GetSection("appSettings");
            myApp.Settings["lcc"].Value = val;
            config.Save();
            return val;

        }
关于winform的appconfig的读写操作

 

关于winform的appconfig的读写操作,布布扣,bubuko.com

关于winform的appconfig的读写操作

上一篇:BaseAnimation是基于开源的APP,致力于收集各种动画效果(最新版本1.3) (转)


下一篇:微信小程序中的 hover-class