[导入]NameValueSectionHandler 和 DictionarySectionHandler 的自定义元素
为使用
<configuration>
<sectionName>
<sectionName></sectionName>
子元素
备注
<sectionName> 元素是由 <configSections> 元素中的 <section> 标记定义的自定义元素。
下表显示
| 配置节处理程序 | 返回类型 |
|---|---|
示例
下面的示例说明如何声明那些使用 DictionarySectionHandler 和 NameValueSectionHandler 类的节。自定义元素是 <dictionarySample>(包含由 DictionarySectionHandler 类读取的设置)和 <mySection>(包含由 NameValueSectionHandler 类读取的设置)。
<configuration>
<configSections>
<section name="dictionarySample"
type="System.Configuration.DictionarySectionHandler,System"/>
<sectionGroup name="mySectionGroup">
<section name="mySection"
type="System.Configuration.NameValueSectionHandler,System" />
</sectionGroup>
</configSections>
<dictionarySample>
<add key="myKey" value="myValue"/>
</dictionarySample>
<mySectionGroup>
<mySection>
<add key="key1" value="value1" />
</mySection>
</mySectionGroup>
</configuration>
配置文件
此元素可用于应用程序目录级以外的应用程序配置文件、计算机配置文件 (Machine.config) 和 Web.config 文件中
文章来源:http://www.codeguru.cn/ShowThread.aspx?PostID=728
浙公网安备 33010602011771号