[英]using elements in app.config file
Currently my app config settings are look like this 目前,我的应用配置设置如下所示
<appSettings>
<add key="ConnectionString" value="server=localhost;user=;port=;" />
<add key="MS" value="MSr" />
<add key="MassagesTable" value="Massages" />
</appSettings>
I want to add an inner elements under "MassagesTable"
with names columnOne
and ColumnTwo
. 我想在名称为
columnOne
和ColumnTwo
"MassagesTable"
columnOne
"MassagesTable"
下添加一个内部元素。 How I can do it , and them to read it from the code . 我该怎么做,他们从代码中读取它。
Currently I do it like ConfigurationManager.AppSettings["ConnectionString"];
目前,我喜欢
ConfigurationManager.AppSettings["ConnectionString"];
Thanks for help. 感谢帮助。
You can find an example here: Custom type application settings in ASP.NET 您可以在此处找到一个示例: ASP.NET中的自定义类型应用程序设置
Basically you can add any custom object as a setting, as long as you used 'typed settings' and the classes XML-serializable or have type converters. 基本上,您可以添加任何自定义对象作为设置,只要您使用“类型化设置”和XML可序列化的类或具有类型转换器即可。 You should use
applicaitonSettings
section instead of appSettings
for this. 为此,您应该使用
applicaitonSettings
部分而不是appSettings
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.