Runtime appconfig value changes
I want to ask about reading the app config property value.
I can change some of the app config property value during runtime and I could use that property value in my code. So, how to get that runtime changed app config property value in my code? Is there any options to get the runtime changed app config value i开发者_开发技巧n C#.NET?
After saving the changes to the app config, do like this
ConfigurationManager.RefreshSection(sectionName);
to get the updated values.
Have a look at this page.
You can use ConfigurationManager
to modify the config files and then use the RefreshSection
after saving the settings but how are you trying to access the new information in case you are using GetSection
then its unlikely you would get the changes as its getting read from cache. You will have to use OpenExeConfiguration
i think to read the new changes.
It is not a good practice to change the configurations at runtime you should choose to revisit your purpose once again
精彩评论