Create Custom Configuration Sections


You want to use a custom configuration setting to organize related custom settings.


Register your custom setting with the System.Configuration.NameValueSectionHandler class. You can then use the shared ConfigurationSettings.GetConfig method to retrieve a collection of settings from the section.


.NET uses an extensible system of configuration file settings. You have multiple options for reading custom settings from a configuration file:

  • Place your custom settings in the <appSettings> group, and access them through the ConfigurationSettings.AppSettings collection. This approach was used in recipe Read Application Configuration Settings.

  • Create your own custom section handler by implementing ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.