473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Complex app.config setting

Hi !

I understand that dotNet offers app.config to store application
configuration as below:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<add key="MySettingKey2" value="MySettingValue2" />
</appSetting>
</configuration>

But this type of configuration is too flat. I want to have something
like this:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<subElement1>A</subElement1>
<subElement2>B</subElement2>
</add>
</appSetting>
</configuration>

How could this read this using ConfigurationSetting class ?

Thanks

Bob
Nov 22 '05 #1
6 2154
Create as key value pairs and parse. Under 2.0 you have other options, but
today it is done like so:

<configuration>
<appSetting>
<add key="MySettingKey1" value="key=X;Sub1=Y;Sub2=Z" />
</appSetting>
</configuration>

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"wuji" wrote:
Hi !

I understand that dotNet offers app.config to store application
configuration as below:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<add key="MySettingKey2" value="MySettingValue2" />
</appSetting>
</configuration>

But this type of configuration is too flat. I want to have something
like this:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<subElement1>A</subElement1>
<subElement2>B</subElement2>
</add>
</appSetting>
</configuration>

How could this read this using ConfigurationSetting class ?

Thanks

Bob

Nov 22 '05 #2
Create as key value pairs and parse. Under 2.0 you have other options, but
today it is done like so:

<configuration>
<appSetting>
<add key="MySettingKey1" value="key=X;Sub1=Y;Sub2=Z" />
</appSetting>
</configuration>

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"wuji" wrote:
Hi !

I understand that dotNet offers app.config to store application
configuration as below:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<add key="MySettingKey2" value="MySettingValue2" />
</appSetting>
</configuration>

But this type of configuration is too flat. I want to have something
like this:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<subElement1>A</subElement1>
<subElement2>B</subElement2>
</add>
</appSetting>
</configuration>

How could this read this using ConfigurationSetting class ?

Thanks

Bob

Nov 22 '05 #3
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.

Nov 22 '05 #4
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.

Nov 22 '05 #5
"Chris Dunaway" <du******@gmail.com> wrote in news:1119045470.454569.12900
@o13g2000cwo.googlegroups.com:
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.


You may find this even easier:
http://tinyurl.com/97nzb
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 22 '05 #6
"Chris Dunaway" <du******@gmail.com> wrote in news:1119045470.454569.12900
@o13g2000cwo.googlegroups.com:
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.


You may find this even easier:
http://tinyurl.com/97nzb
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Max Metral | last post by:
I'm trying to set the default behavior of customErrors in the machine.config. The documentation seems to suggest this should work, but it doesn't seem to work for me. On my development machine, I...
12
by: Ben | last post by:
I have a group of settings that I'd like to have inherited by multiple sites. I'm trying this, but it's not working. wwwroot\group\web.config wwwroot\group\site1\web.config...
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
9
by: antonyliu2002 | last post by:
By default, IIS is configured to timeout a session in 20 minutes, which can be changed through the IIS config window. I use InProc sessionState mode. I can also set the session timeout in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.