如何动态读取刚更改的app.config里的配置项的值?
我在程序里用app.config配置项来记录收费日期,更改了后,再马上读取就不行,要重启程序才能行。
通过查阅资料,我加了ConfigurationManager.RefreshSection("appSettings");来刷新。但还是不行。请问如何解决呢?
代码如下:
//
ConfigurationManager.RefreshSection("appSettings");
//
int oneyear = Convert.ToInt32(ConfigManager.GetValue("one_year"));
int onemonth = Convert.ToInt32(ConfigManager.GetValue("one_month"));
this.numericUpDown1.Value = oneyear;
this.numericUpDown2.Value = onemonth;
我在程序里用app.config配置项来记录收费日期,更改了后,再马上读取就不行,要重启程序才能行。
通过查阅资料,我加了ConfigurationManager.RefreshSection("appSettings");来刷新。但还是不行。请问如何解决呢?
代码如下:
//
ConfigurationManager.RefreshSection("appSettings");
//
int oneyear = Convert.ToInt32(ConfigManager.GetValue("one_year"));
int onemonth = Convert.ToInt32(ConfigManager.GetValue("one_month"));
this.numericUpDown1.Value = oneyear;
this.numericUpDown2.Value = onemonth;





2007-12-19 13:15

