Night Walker
Night Walker

Reputation: 21280

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. How I can do it , and them to read it from the code .

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

Thanks for help.

Upvotes: 1

Views: 1400

Answers (1)

Alex Aza
Alex Aza

Reputation: 78537

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.

Upvotes: 1

Related Questions