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

前端 未结 4 1721
野趣味
野趣味 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:32

    Alternatively, you could create a singleton 'Options' to hold on to your application settings and perform your read/writes for you. Once loaded, changing the .config doesn't require reloading, you simply set a property on the singleton and call your .Save() method.

    The 'runtime' version of your settings is in the singleton, no need to read from disk.

提交回复
热议问题