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:
- 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.
We are going to create a Windows Console application. All it’s going to do is display values from the config file. When we are completed with the application it will display something similar to this: