How to get the child list of a section group in app.config

G

Guest

In app.config, I create a sectionGroup which includes NameValueSectionHandler
and SingleTagSectionHandler. How can I get the child list of that
sectionGroup? Is there any build-in functions like
ConfigurationSettings.GetConfig("")? Or I need to write a function to find
the child node?

For example, the app.config
<sectionGroup name="table1">
<section name="connection"
type="System.Configuration.NameValueSectionHandler" />
<section name="col1" type="System.Configuration.SingleTagSectionHandler" />
<section name="col2" type="System.Configuration.SingleTagSectionHandler" />
<section name="col3" type="System.Configuration.SingleTagSectionHandler" />
</sectionGroup>

<table1>
<connection>
<add key="tablename" value="table1" />
<add key="connectionstring" value="Persist Security Info=False;Integrated
Security=False;Connect Timeout=30;server=localhost;database=a;User
ID=a;Password=a;" />
<add key="selectsql" value="Select * From table1" />
</connection>
<col1 field="char1" type="char" length="5" />
<col2 field="varchar1" type="varchar" length="10" />
<col3 field="nvarchar1" type="nvarchar" length="50" />
</table1>

How can I get the child node sectionGroup "table1"?? I want to retrive the
following list: connection, col1, col2, col3.

Thanks.
 
G

Guest

Seach the .NET help for "Declaring and Accessing Section Groups" and you'll
have your answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top