Reading a custom ".config" file programmatically

G

Guest

Hello All,

I have created my own custom configuration file. I would like to know about
API available to read that config file. Since config file is nothing but an
XML file, I could definitetly use the XML Dom API. But are there any other
options because I see that for example to read a setting called as
"Connectionstring" in web.config we use .......
System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
Similarly how can I use this to read from a custom config file?

Thanks for suggestions!!!
 
C

Curt_C [MVP]

Diffident said:
Hello All,

I have created my own custom configuration file. I would like to know about
API available to read that config file. Since config file is nothing but an
XML file, I could definitetly use the XML Dom API. But are there any other
options because I see that for example to read a setting called as
"Connectionstring" in web.config we use .......
System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
Similarly how can I use this to read from a custom config file?

Thanks for suggestions!!!

Create a custom class called MyConfig and simply parse in the
"settings", as you mentioned they are just XML, then you can simply
point to YourApp.MyConfig.blah for the value. Use a simple Get/Set to
access.
 

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