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

查看:44
本文介绍了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>

我的意思是,我想在配置文件中有一个返回值列表的键.怎么做?觉得很简单,就是找不到例子

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天全站免登陆