开发者

using elements in app.config file

开发者 https://www.devze.com 2023-03-15 03:26 出处:网络
Currently my app config settings are look like this <appSettings> <add key=\"ConnectionString\" value=\"server=localhost;user=;port=;\" />

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 开发者_Python百科inner elements under "MassagesTable" with names columnOne and ColumnTwo. How I can do it , and them to read it from the code .

Currently I do it like ConfigurationManager.AppSettings["ConnectionString"];

Thanks for help.


You can find an example here: Custom type application settings in 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. You should use applicaitonSettings section instead of appSettings for this.

0

精彩评论

暂无评论...
验证码 换一张
取 消