Pair attribute naming in custom configSections
- by fearofawhackplanet
I'm trying to store a user list in a config file. I've been looking at DictionarySectionHandler and NameValueSectionHandler. I'm not too sure what the difference between these two is, but anyway, neither of them do exactly what I'd like.
You can add a custom config section like so:
<configSections>
<section name="userAges" type="System.Configuration.DictionarySectionHandler"/>
</configSections>
<userAges>
<add key="userName1" value="10" />
<add key="userName2" value="52" />
<userAges>
Which is ok, but actually I'd prefer to be able to write:
...
<userAges>
<add user="userName1" age="10" />
<add user="userName2" age="52" />
<userAges>
Which I feel would make the config file clearer to anyone who needed to add/remove users in future.
Is there an easy way to do this?