我记得曾经读到过,.NET有一个内置的configSection处理程序,它可以处理一组键/值对,而不必编写我自己的自定义类。类似于appSettings,但我可以将包含标记命名为自己的名称,并开始列出键/值对。
有人知道它是否存在吗?它叫什么?
示例:
<configuration>
<configSections>
<section name="myKeys" type="Some.Built.In.Assembly, Some.Built.In.Assembly" />
</configSections>
<myKeys>
<add key="1" value="1" />
<add key="2" value="2" />
<add key="3" value="3" />
</myKeys>发布于 2012-03-14 22:13:28
你要找的是System.Configuration.NameValueFileSectionHandler.它的用法示例可以在这里找到:4guysfromrolla.com/articles/053102-1.aspx
(编辑类名中的拼写错误)
https://stackoverflow.com/questions/9689767
复制相似问题