【发布时间】:2010-09-30 03:36:21
【问题描述】:
我正在使用 .NET Fx 3.5 并编写了自己的配置类,这些配置类继承自 ConfigurationSection/ConfigurationElement。目前,我的配置文件中的内容如下所示:
<blah.mail>
<templates>
<add name="TemplateNbr1" subject="..." body="Hi!\r\nThis is a test.\r\n.">
<from address="blah@hotmail.com" />
</add>
</templates>
</blah.mail>
我希望能够将 body 表示为 template 的子节点(即上面示例中的 add 节点),最终得到如下所示的内容:
<blah.mail>
<templates>
<add name="TemplateNbr1" subject="...">
<from address="blah@hotmail.com" />
<body><![CDATA[Hi!
This is a test.
]]></body>
</add>
</templates>
</blah.mail>
【问题讨论】:
标签: c# configuration configuration-files