Create a custom block in web.config for web.config with a random number of elements

I need to create a custom block in web configuration as follows:   

<MySettings>
    <add name="name1" value="value1" />
    <add name="name2" value="value2" />
    <add name="name3" value="value3" />
    ...
</MySettings>

Ad, I understand, I have to get my own settings class from ConfigurationSection, but I don't know how to make it scalable. I need to add many elements to this block and use it as a key-value pair.

I also understand that all this can be done through the section, but I need to create a custom one, because for me there may not be enough key fields and values, and I will need to expand them.

Thank you very much for your help!

+1
source share
1 answer

add/clear/remove, , MySettings, ConfigurationElementCollection.

+2

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


All Articles