.net读写config appsetting

    this.txtOutPutPath.Text = ConfigurationManager.AppSettings["OutPutPath"];
            this.txtFilter.Text = ConfigurationManager.AppSettings["Filter"];

    Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                configuration.AppSettings.Settings["OutPutPath"].Value = this.txtOutPutPath.Text;
                configuration.AppSettings.Settings["Filter"].Value = this.txtFilter.Text;
                //保存配置文件
                configuration.Save();
                ConfigurationManager.RefreshSection("appSettings"); // 实时刷新

 

posted @ 2016-11-10 09:23  晓明的哥哥  阅读(443)  评论(0编辑  收藏  举报