O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Create Custom Configuration Sections

Problem

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

Solution

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.

Discussion

.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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required