Geeks With Blogs
Daniel Schroeder Sharing my tips and tricks to help other developers be more productive. This blog has moved to

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…


Posted on Tuesday, September 25, 2012 4:00 PM | Back to top

Comments on this post: Adding and accessing custom sections in your C# App.config

# re: Adding and accessing custom sections in your C# App.config
Requesting Gravatar...
After browsing at least a dozen websites on custom config sections, yours is the one that help me nail the issue. Thanks a ton.
Left by kartik malik on Apr 25, 2013 12:19 AM

Your comment:
 (will show your gravatar)

Copyright © deadlydog | Powered by: | Join free