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 - 40 , trackbacks - 0

My Links

News

This blog has moved to http://blog.danskingdom.com

Twitter












Archives

Tuesday, September 25, 2012

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/

Posted On Tuesday, September 25, 2012 4:00 PM | Comments (1) |

Powered by: