O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

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

System.Configuration

System.Configuration is a namespace that contains classes for reading and manipulating configuration files. Listing B.48 (configuration.exe.config) shows a sample configuration file.

Listing B.48. Application Configuration File
<configuration>
    <appSettings>
        <add key="Application Name" value="MyApplication" />
        <add key="Application Size" value="10X10" />
        <add key="Application Position" value="Middle" />
        <add key="Application Duration" value="Infinite" />
    </appSettings>
</configuration>

The code in Listing B.49 retrieves the configuration settings (configuration.cs) from the configuration file in Listing B.48.

Listing B.49. Reading an Application Configuration File
 public class ConfigurationMain { static void Main(string ...

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