How to read custom configuration section in app.config in C #

I want to read the following user 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 speak for several <Folders> tags. Please, help?

+4
source share
1 answer

Hi, you can access custom sections such as

 CustomConfigClass section = (CustomConfigClass)ConfigurationManager.GetSection("StartupFolders"); 

Hope this helps you.

+1
source

Source: https://habr.com/ru/post/1388107/


All Articles