C# 自定义配置节点简例

来源:互联网 发布:python append用法 编辑:程序博客网 时间:2024/05/29 13:16

参考:

  • 《How to: Create Custom Configuration Sections Using ConfigurationSection》
  • 《Custom Configuration Sections for Lazy Coders》
  • 《How to: Add CData or Text in a ConfigurationElement》

示例配置文件:

 

<?xml version="1.0" encoding="utf-8" ?><configuration>  <configSections>    <section name="mySection" type="SimpleCustomConfigSection.MySection, SimpleCustomConfigSection" />  </configSections>  <mySection>    <common value="value of common" />    <inner>value of inner</inner>    <collection>      <add key="key1" value="value1" />      <add key="key2" value="value2" />      <remove key="key1" />    </collection>  </mySection></configuration>

 

代码见附件