C#

Custom configuration sections in C#

This is the best article I’ve read about this topic. Very clear and lots of screenshots to show the correlation between the config file and the programatical equivalent. Only drawback is that the code samples can’t be copied pasted because the author took screenshots of the code snippets rather than inserting them as code excerpts.

BarDev - Archive

This post will provide an example and explanation of how to create custom configuration for C# applications. I will discuss ConfigurationSections, ConfigurationElements, ConfigurationElementCollection. Also I will discuss how to nest these items together. My plan is to take very small steps; implementing each part of the configuration individually.

By the end of the post we will be able to navigate a custom configuration similar to the following config file:

Assumption

  • Good understanding of C#
  • Good understanding Visual Studio – I’m will be using VS 2012
  • .NET 3.5 and higher
  • Basic understanding of configuration files

The application we are going to create is quite contrived. The school settings that we will store in the config file would usually be stored in a database, but I want to provide a domain that most people understand.

Our Domain

A School has
A Name
A Address
Zero or More Courses
A Course has
A…

View original post 1,582 more words

Advertisements