Reputation: 33850
I am looking inside the code inside System.Configuration.dll
and it looks like the .NET framework reads the file every time you access ConfigurationManager.Whatever
, for e.g. ConfigurationManager.AppSettings["foo"]
;
This worries me. This can't be. Please prove that I am wrong.
Upvotes: 0
Views: 179
Reputation: 25013
You can do a simple test yourself. Show a value from the config file. Edit the config file while the program is still running. Show the value again - it is the same.
Also, you can use Process Monitor from Sysinternals to show file accesses - the config file is only accessed when the program starts.
(It is different for web.config in ASP.NET applications, where a change in web.config results in the application being restarted: When is the web.config file “executed”?.)
Upvotes: 2