Re: multiple same section in app.config
- From: Droopy <droopytoonnospam@xxxxxxxxxxx>
- Date: 15 Sep 2006 06:53:49 GMT
I already tried your solution.
I got an exception "Sections must only appear once per config file".
"Sean Chambers" <dkode8@xxxxxxxxx> wrote in news:1158248668.638399.124870
@e3g2000cwe.googlegroups.com:
Perhaps moving the ID into an attribute on <Connection>same
I.E.:
<Connection ID="2">
<add key="ComPort" value="COM4" />
<add key="Name" value="Connection 2" />
</Connection>
Droopy wrote:
Hi,
I would like to configure some device connections through app.config.
I created the following config file but it fails because I have the
section more than once :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="Connections">
<section name="Connection"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</configSections>
<Connections>
<Connection>
<add key="ComPort" value="COM2" />
<add key="Name" value="Connection 1" />
<add key="ID" value="1" />
</Connection>
<Connection>
<add key="ComPort" value="COM4" />
<add key="Name" value="Connection 2" />
<add key="ID" value="2" />
</Connection>
</Connections>
</configuration>
I have 2 questions :
1) How should I modify this configuration file ?
2) Now that ConfigurationSettings.GetConfig is obsolete, is does not
seems clear for me how to use ConfigurationManager to read the config
file.
Thanks in advance,
Droopy.
.
- References:
- multiple same section in app.config
- From: Droopy
- Re: multiple same section in app.config
- From: Sean Chambers
- multiple same section in app.config
- Prev by Date: time problem
- Next by Date: Re: multiple same section in app.config
- Previous by thread: Re: multiple same section in app.config
- Next by thread: Re: multiple same section in app.config
- Index(es):
Relevant Pages
|
Loading