除非我做错了什么,顺便我应该使用的ConfigurationSection,和的ConfigurationElement ConfigurationElementCollection中,要求我格式化我的配置部分,像这样:web.config中的自定义配置节和不必要的冗长
<serviceAuthorization>
<credentials>
<login username="system" password="password" mode="include">
<services>
<service type="AxeFrog.Mobile.Service.Security.AuthenticationService, AxeFrog.Mobile.Service" />
<service type="AxeFrog.Mobile.Service.Security.AnotherService, AxeFrog.Mobile.Service" />
</services>
</login>
<login username="test" password="pass" mode="exclude" />
</credentials>
</serviceAuthorization>
我如果我在格式中多说一点,会更喜欢。我想格式化我的部分是这样的:
<serviceAuthorization>
<login username="system" password="password" mode="include">
<service type="AxeFrog.Mobile.Service.Security.AuthenticationService, AxeFrog.Mobile.Service" />
<service type="AxeFrog.Mobile.Service.Security.AnotherService, AxeFrog.Mobile.Service" />
</login>
<login username="test" password="pass" mode="exclude" />
</serviceAuthorization>
有没有一种方法,我可以得到配置节的XML,只是读它自己?
据我了解,IConfigurationSectionHandler已被弃用 – 2009-09-01 08:08:03
你是绝对正确的。我将它添加到我的答案中。 – 2009-09-01 08:52:01