【发布时间】:2010-10-20 00:40:36
【问题描述】:
如果我使用这样的 app.config,通过继承自 System.Configuration.Section 的类获取“页面”列表的正确方法是什么?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="XrbSettings" type="Xrb.UI.XrbSettings,Xrb.UI" />
</configSections>
<XrbSettings>
<pages>
<add title="Google" url="http://www.google.com" />
<add title="Yahoo" url="http://www.yahoo.com" />
</pages>
</XrbSettings>
</configuration>
【问题讨论】:
-
您还应该在 CodeProject 上查看 Jon Rista 关于 .NET 2.0 配置的三部分系列。 - Unraveling the mysteries of .NET 2.0 configuration - Decoding the mysteries of .NET 2.0 configuration - Cracking the mysteries of .NET 2.0 configuration 强烈推荐,写得很好,非常有帮助!
-
另外,如果您发现自己经常创建配置部分,可以使用 Configuration Section Designer,一个用于设计配置部分的图形化领域特定语言设计器。
标签: .net configuration app-config configsection