我正在使用.NET 的Configuration Section Designer来构建一个简单的ConfigurationElementCollection.它似乎一切都建立得很好,因为子元素与智能感知可见的是自动生成的代码.
不幸的是,即使我在配置部分中向集合添加了元素,它们在运行时也不存在; 它显示集合的Length属性为0 - 即使集合是空的,正如您在我的示例XML中看到的,我已经明确地将它们放在那里:
<logParserSettings xmlns="LogParser">
<domainControllers>
<domainController ID="0" name="Local" serverType="Local" enabled="true"/>
<domainController ID="1" name="DC1" serverType="WindowsServer2003" enabled="false" />
<domainController ID="2" name="DC2" serverType="WindowsServer2008" enabled="false" />
</domainControllers>
</logParserSettings>
Run Code Online (Sandbox Code Playgroud)
ConfigurationSection,a ConfigurationElementCollection和a ConfigurationElement- 没有其他配置元素/部分/组Singleton属性,但单例实例和设置类的实例似乎都不起作用Is Key属性设置为true,所有其他属性都标记为trueIs Required有没有人碰到这个?如果是这样,我必须做出哪些改变才能使其按预期工作?