问题
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>
I found this link, but it does not say for multiple <Folders>
tag. Please help?
回答1:
Hi You can Access custom sections like this
CustomConfigClass section = (CustomConfigClass)ConfigurationManager.GetSection("StartupFolders");
Hope it helps you.
来源:https://stackoverflow.com/questions/8643498/how-to-read-custom-config-section-in-app-config-in-c-sharp