在.NET中,我们可以使用<configSections>
元素创建自定义配置节,就像这样:DictionarySectionHandler和NameValueSectionHandler有区别吗?
<configuration>
<configSections>
<section name="dictionarySample"
type="System.Configuration.DictionarySectionHandler"/>
<section name="nameValueSample"
type="System.Configuration.NameValueSectionHandler" />
</configSections>
<dictionarySample>
<add key="key1"
value="value1"/>
</dictionarySample>
<nameValueSample>
<add key="key2"
value="value2" />
</nameValueSample>
</configuration>
上面,我定义两个部分。其中一种类型为DictionarySectionHandler
,另一种类型为NameValueSectionHandler
。
据我所知,这两个处理程序的使用方式完全相同,并且导致相同的配置部分。
那么,有没有区别,还是我可以互换使用它们?