Hem*_*yal 5 c# app-config configsection
我想从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>
Run Code Online (Sandbox Code Playgroud)
我找到了此链接,但没有为多个<Folders>标签说。请帮忙?
小智 2
您好,您可以像这样访问自定义部分
CustomConfigClass section = (CustomConfigClass)ConfigurationManager.GetSection("StartupFolders");
Run Code Online (Sandbox Code Playgroud)
希望对您有帮助。