app.config multiple values by single key [duplicate]
is it possible to have app.config file like this :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="someKey" value="valueHere"/>
<add key="anotherKey" value="valueHere"/>
<add key="listOfValues">
<value1/>
...
<valueN/>
</add>
</appSettings>
</configuration>
I mean, I want to have a key in config file that returns a list of values.How to do it? Think it's pretty easy, but I just can't find any examples
UPD : may开发者_如何转开发be I should put multiple values separated by semicolon and then just split them?.. But I think it is not very good idea...
I don't think the standard key/value pair config settings can do it, but with a little more coding you can have all the configuration XML goodness you want with a custom config section.
Don't know if what you're asking is possible. But what I do is I concatenate values using a separator like ";" for instance.
So you have something like:
<add key="runningDays" value="Mon;Tue;Wed;Thu;Fri"/>
Then I split the value string from config using the separator to get the list of possible values for the given key.
精彩评论