Reputation: 9277
I would like that with an unique key on web.config, retrieve a dictionary of keyvalues.
To explain myself i little better, i would like to generate a dictionary with as many entries as "key values separated by comma" in the value of MyCodes app setting.
<add key="MyCodes" value="Members,X4567423
NonMembers,Y32453
Registered,Z12312
....
" />
As example and imaging that this is possible i would like to use it like
ConfigurationManager.AppSettings["MyCodes"]["Members"]
Is it possible?
Upvotes: 0
Views: 187
Reputation: 5853
I would create a Settings file and then create a Dictionary in it. Not only does it give you want you want, but you have better type safety as well.
Upvotes: 1
Reputation: 39888
The way you want to access it with ConfigurationManager.AppSettings["MyCodes"]["Members"]
is a dream :)
What you can do is create a wrapper class that will parse MyCodes
and split them for you. Then you can access the different values not trough your ConfigurationManager
but trough your wrapper class.
Upvotes: 1