我想阅读 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>
我找到了 this link , 但它没有说多个 <Folders>
标签。请帮忙?
最佳答案
您好,您可以像这样访问自定义部分
CustomConfigClass section = (CustomConfigClass)ConfigurationManager.GetSection("StartupFolders");
希望对你有帮助。
关于c# - 如何在 C# 中读取 app.config 中的自定义配置部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8643498/