Solved

System.Configuration in .net 2.0 C#

Posted on 2006-11-15
3
212 Views
Last Modified: 2012-08-13
Hi

Can anyone please let me know how to read this type of complex ConfigurationSection from App.config.
I am currently able to read simple Configuration Sections but as the complexity increase....i am unable read em...
as a sample i would aprreciate it if someone could write the classes needed for the below.

<ViewConfiguration>
    <View name="View1">
      <Controls>
        <Control name="Control1"/>
        <Control name="Control2"/>
      </Controls>
    </View>
    <View name="View2" >
      <Controls>
        <Control name="Control1"/>
        <Control name="Control2"/>
      </Controls>
    </View>
  </ViewConfiguration>


Thank u in advance.....
0
Comment
Question by:me_new
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
joechina earned 100 total points
ID: 17947337
I bet you don't want to do that. You have to create your own ConfigurationSection handler.
Example see the How-To link from the following page.
http://msdn2.microsoft.com/en-us/library/ms228062.aspx

The other option is to modify your configuration file to

<sectionGroup name="ViewConfiguration">
      <section name="View1" type="System.Configuration.NameValueSectionHandler"/>
      <section name="View2" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>

<ViewConfiguration>
    <View1>
      <add key="Control1" value="anything you want to specify or you can leave it blank"/>
      <add key="Control2" value="..."/>    
    </View1>
    <View2>
      <add key="Control1" value="..."/>
      <add key="Control2" value="..."/>
    </View2>
</ViewConfiguration>

Then you can use .net 2.0 build in method to get the information out.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question