如何阅读在C#中的app.config自定义配置节 [英] How to read custom config section in app.config in c#
本文介绍了如何阅读在C#中的app.config自定义配置节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想读下面从app.config中的自定义部分:
I want to read following custom section from app.config:
<StartupFolders>
<Folders name="a">
<add folderType="Inst" path="c:\foo" />
<add folderType="Prof" path="C:\foo1" />
</Folders>
<Folders name="b">
<add folderType="Inst" path="c:\foo" />
<add folderType="Prof" path="C:\foo1" />
</Folders>
</StartupFolders>
我发现的此链接,但它并没有说多<&文件夹GT;
标记。请帮助?
I found this link, but it does not say for multiple <Folders>
tag. Please help?
推荐答案
您可以访问自定义的部分像这样
Hi You can Access custom sections like this
CustomConfigClass section = (CustomConfigClass)ConfigurationManager.GetSection("StartupFolders");
希望它可以帮助你。
Hope it helps you.
这篇关于如何阅读在C#中的app.config自定义配置节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文