开发者

ConfigurationManager Class and On Demand configuration changes

开发者 https://www.devze.com 2023-01-06 06:59 出处:网络
Are there any events that will fire if someone edited my custom made applicatio开发者_StackOverflow社区n config? I wanted to know such changes and apply it on my application. If this is a web applicat

Are there any events that will fire if someone edited my custom made applicatio开发者_StackOverflow社区n config? I wanted to know such changes and apply it on my application.


If this is a web application, then this happens automatically.

If it's non-web (and you have an app.config), use FileSystemWatcher to monitor the file. When the event files, restart the application (use Application.Restart()) - or just re-load your configuration values in whatever way you initially did. Like, if you have a public read-only property in a "Settings" class, just re-load the settings on that event. Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消