简体   繁体   中英

ConfigurationManager.GetSection() function

Can someone elaborate how this function works? Does it load every time from disk or it caches it somewhere in memory etc? Thanks in advance.

.NET caches this and invalidates when the web.config changes

Also when in doubt open the decompiled sources and look at the code, it not only will give you the answer but you will learn a lot..

当应用程序运行时,整个配置将加载到内存中,每当您尝试访问时,都会从内存中检索所需的部分

Configuration is in memory, any external change in the disk config file would have to be reloaded (standalone apps)

ConfigurationManager.RefreshSection(sectionName); [1]

[1] http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.refreshsection.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM