简体   繁体   English

ConfigurationManager.GetSection()函数

[英]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 .NET会缓存此问题,并在web.config更改时失效

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 [1] http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.refreshsection.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ConfigurationManager.GetSection跳过重复项 - ConfigurationManager.GetSection Skips Duplicates ConfigurationManager.GetSection 返回 null - ConfigurationManager.GetSection returns null ReadOnlyNameValueCollection(从ConfigurationManager.GetSection读取) - ReadOnlyNameValueCollection (reading from ConfigurationManager.GetSection) ConfigurationSection ConfigurationManager.GetSection()始终返回null - ConfigurationSection ConfigurationManager.GetSection() always returns null ConfigurationManager.GetSection和Configuration.GetSection有什么区别? - What is Difference between ConfigurationManager.GetSection and Configuration.GetSection? ConfigurationManager.GetSection始终为对象提供默认值 - ConfigurationManager.GetSection always gives object with default values ConfigurationManager.GetSection不返回自定义部分 - ConfigurationManager.GetSection doesn't return custom section 如何在.Net Core 2.2中正确使用ConfigurationManager.GetSection() - How to use properly ConfigurationManager.GetSection() in .Net Core 2.2 为什么ConfigurationManager.GetSection“ system.webServer / handlers”不可用? - Why is the ConfigurationManager.GetSection “system.webServer/handlers” not available? 在类库的 App.config 中使用 ConfigurationManager.GetSection - Using ConfigurationManager.GetSection in a Class Library's App.config
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM