[英]how to add custom configSections to app.config file through code
How can I add sections to an app.config file through code? 如何通过代码将部分添加到app.config文件?
Something like this in my config file, but it can have multiple sections but not through appSettings as I would like to add multiple values to it. 我的配置文件中有类似的内容,但是它可以有多个部分,但不能通过appSettings进行,因为我想向其中添加多个值。
<configSections>
<!-- CUSTOM CONFIG SECTIONS BELOW -->
<section name="EmailSection" type="Email.EmailSection, Email" />
</configSections>
<EmailSection>
<Emails>
<email id="HOST" name="mail.somedomain.com" />
<email id="PORT" name="25" />
<email id="TOADDRESS" name="" />
<email id="FROMADDRESS" name="dev@somedomain.com" />
</Emails>
</EmailSection>
I would like to do this through an import method in my code so i can select an xml file which will then add the sections to my app.config. 我想通过代码中的导入方法来执行此操作,因此我可以选择一个xml文件,然后将这些部分添加到我的app.config中。
Regards 问候
Aidan 艾丹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.