Alex Rivera | Logout

How to read this custom configuration from App.config?

Asked 2011-06-02T18:20:42.620
10

How to read this custom configuration from App.config?

<root name="myRoot" type="rootType">
    <element name="myName" type="myType" />
    <element name="hisName" type="hisType" />
    <element name="yourName" type="yourType" />
  </root>

Rather than this:

<root name="myRoot" type="rootType">
  <elements>
    <element name="myName" type="myType" />
    <element name="hisName" type="hisType" />
    <element name="yourName" type="yourType" />
  </elements>
  </root>
Edit
Report

1 Answer

7

You can use System.Configuration.GetSection() method for reading custom configuration sections.

Refer to http://msdn.microsoft.com/en-us/library/system.configuration.configuration.getsection.aspx for knowing more about GetSection()

answered 2011-06-02T18:24:59.147

Your Answer