Daniel Schroeder

Sharing my tips and tricks to help other developers be more productive. This blog has moved to http://blog.danskingdom.com
posts - 44 , comments - 41 , trackbacks - 0

Adding and accessing custom sections in your C# App.config

So I recently thought I’d try using the app.config file to specify some data for my application (such as URLs) rather than hard-coding it into my app, which would require a recompile and redeploy of my app if one of our URLs changed.  By using the app.config it allows a user to just open up the .config file that sits beside their .exe file and edit the URLs right there and then re-run the app; no recompiling, no redeployment necessary.

I spent a good few hours fighting with the app.config and looking at examples on Google before I was able to get things to work properly.  Most of the examples I found showed you how to pull a value from the app.config if you knew the specific key of the element you wanted to retrieve, but it took me a while to find a way to simply loop through all elements in a section, so I thought I would share my solutions here…

Read more at http://blog.danskingdom.com/adding-and-accessing-custom-sections-in-your-c-app-config/

Print | posted on Tuesday, September 25, 2012 4:00 PM |



# re: Adding and accessing custom sections in your C# App.config

After browsing at least a dozen websites on custom config sections, yours is the one that help me nail the issue. Thanks a ton.
4/25/2013 12:19 AM | kartik malik
Post A Comment

Powered by: