Custom app.config section with a simple list of "add" elements
Posted
by Joe
on Stack Overflow
See other posts from Stack Overflow
or by Joe
Published on 2010-04-27T01:07:46Z
Indexed on
2010/04/27
1:13 UTC
Read the original article
Hit count: 282
How do I create a custom app.config section that is just a simple list of add
elements?
I have found a few examples (e.g. http://stackoverflow.com/questions/1316058) for custom sections that look like this:
<RegisterCompanies>
<Companies>
<Company name="Tata Motors" code="Tata"/>
<Company name="Honda Motors" code="Honda"/>
</Companies>
</RegisterCompanies>
But how do I avoid the extra collection element ("Companies") so that it looks the same as the appSettings
and connectionStrings
sections? In other words, I'd like:
<registerCompanies>
<add name="Tata Motors" code="Tata"/>
<add name="Honda Motors" code="Honda"/>
</registerCompanies>
© Stack Overflow or respective owner