Change in AppSettings needs restart my Application how can I avoid?

前端 未结 4 1725
野趣味
野趣味 2021-02-08 13:09

I\'m using C# .NET 2.0 Windows Application.

and I\'m using app.config for my Application Settings.

but change in AppSettings doesn\'t reflected runtime, it Needs

4条回答
  •  既然无缘
    2021-02-08 13:56

    You could try calling

    ConfigurationManager.RefreshSection("appSettings")
    to refresh the AppSettings section of the file from disk. Once they have been refreshed, you should be able to read the new values.

    I've just tested this and it does indeed work.

提交回复
热议问题