App.config中由单个键多个值 [英] app.config multiple values by single key

查看:316
本文介绍了App.config中由单个键多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是有可能有这样的app.config文件:

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>



我的意思是,我想在配置文件中的键返回values​​.How的列表做到这一点?
认为这是相当容易,但我只是找不到任何的例子

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:也许我应该把用分号分隔的多个值,然后就拆呢? ..但我认为这不是很好的主意...

UPD : maybe I should put multiple values separated by semicolon and then just split them?.. But I think it is not very good idea...

推荐答案

我不认为标准的键/值对配置设置可以做到这一点,但更多一点的编码,你可以有你想用所有的配置XML善良自定义配置部分

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.

这篇关于App.config中由单个键多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆