【发布时间】:2010-09-20 06:39:45
【问题描述】:
我正在尝试创建类以使用 ConfigurationSection 和 ConfigurationElementCollection 从我的配置文件中读取,但我遇到了困难。
作为配置示例:
<PaymentMethodSettings>
<PaymentMethods>
<PaymentMethod name="blah blah" code="1"/>
<PaymentMethod name="blah blah" code="42"/>
<PaymentMethod name="blah blah" code="43"/>
<Paymentmethod name="Base blah">
<SubPaymentMethod name="blah blah" code="18"/>
<SubPaymentMethod name="blah blah" code="28"/>
<SubPaymentMethod name="blah blah" code="38"/>
</Paymentmethod>
</PaymentMethods>
</PaymentMethodSettings>
【问题讨论】:
-
你能告诉我你想做什么吗?我的意思是当我不知道它背后的原因时,我提供一个 XMLReader 似乎相当侮辱
-
他想在.NET中使用内置的配置类,而不是手动解析文件。
标签: c# xml web-config configurationsection