.net dynamically refresh app.config

前端 未结 10 792
闹比i
闹比i 2020-12-02 23:28

How do I dynamically reload the app.config in a .net Windows application? I need to turn logging on and off dynamically and not just based upon the value at application sta

10条回答
  •  无人及你
    2020-12-02 23:38

    You can refresh your own section the way you say:

    ConfigurationManager.RefreshSection("yoursection/subsection");
    

    Just move a logging true/false into a section and you'll be fine.

提交回复
热议问题