By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,957 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,957 IT Pros & Developers. It's quick & easy.

Reading a Element Collection From a App.config file

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

<configuration>
<configSections>
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common .Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
<sources>
<add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common .Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
filePath="CS.config" />
<add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common .Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</sources>
</enterpriseLibrary.ConfigurationSource>

</configuration>

in the above code one config section "enterpriseLibrary.ConfigurationSource" 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.
Sep 28 '08 #1
Share this Question
Share on Google+
1 Reply


joedeene
100+
P: 583
...so are you asking, basically, how to read the values from the App.config file? how about looking into the system.configuration.ConfigurationManager class? you might find it useful...

joedeene
Sep 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.