Reading a Element Collection From a App.config file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MasterLalit
    New Member
    • Sep 2008
    • 1

    Reading a Element Collection From a App.config file

    Hi,
    i am using a app.config file in my console application.
    App.config code-->

    <configuratio n>
    <configSections >
    <section name="enterpris eLibrary.Config urationSource" type="Microsoft .Practices.Ente rpriseLibrary.C ommon.Configura tion.Configurat ionSourceSectio n, Microsoft.Pract ices.Enterprise Library.Common, Version=3.1.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
    </configSections>
    <enterpriseLibr ary.Configurati onSource selectedSource= "File Configuration Source">
    <sources>
    <add name="File Configuration Source" type="Microsoft .Practices.Ente rpriseLibrary.C ommon.Configura tion.FileConfig urationSource, Microsoft.Pract ices.Enterprise Library.Common, Version=3.1.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a"
    filePath="CS.co nfig" />
    <add name="System Configuration Source" type="Microsoft .Practices.Ente rpriseLibrary.C ommon.Configura tion.SystemConf igurationSource , Microsoft.Pract ices.Enterprise Library.Common, Version=3.1.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
    </sources>
    </enterpriseLibra ry.Configuratio nSource>

    </configuration>

    in the above code one config section "enterpriseLibr ary.Configurati onSource" is present. with in this elements collection ("sources"). i want to get the value of the filePath i.e CS.Config present in side the "Sources" element in my console application.

    can any one help me in getting the values from app.config file.
    Thanks alot in advance.
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    ...so are you asking, basically, how to read the values from the App.config file? how about looking into the system.configur ation.Configura tionManager class? you might find it useful...

    joedeene

    Comment

    Working...