小编the*_*der的帖子

如何使我的自定义配置部分表现得像一个集合?

我如何编写自定义,ConfigurationSection以便它既是段处理程序又是配置元素集合?

通常,您有一个继承自的类,该类具有继承自ConfigurationSection的类型的属性,ConfigurationElementCollection然后返回继承自的类型的集合的元素ConfigurationElement.要配置它,您需要看起来像这样的XML:

<customSection>
  <collection>
    <element name="A" />
    <element name="B" />
    <element name="C" />
  </collection>
</customSection>
Run Code Online (Sandbox Code Playgroud)

我想删除<collection>节点,只需:

<customSection>
  <element name="A" />
  <element name="B" />
  <element name="C" />
<customSection>
Run Code Online (Sandbox Code Playgroud)

c# custom-configuration

16
推荐指数
1
解决办法
8925
查看次数

0
推荐指数
1
解决办法
709
查看次数

标签 统计

c# ×2

custom-configuration ×1

enums ×1

generics ×1