Managing Configuration Settings

Application settings, including general user preferences and state information, are saved in the <appSettings> section of a configuration file. The following code snippet shows some typical output:

<configuration>
   <appSettings>
      <add key="LastLeftTopPosition" value="100,200" />
      <add key="LastSize" value="300,400" />
   </appSettings>
</configuration>

The settings in the preceding sample file refer to the position and size of a window when the application is closed. The syntax of the <appSettings> section is defined as follows:

<appSettings>
   <add key="..." value="..." />
   <remove key="..." />
   <clear />
</appSettings>

The <add> element adds a new setting to the internal collection. This ...

Get Applied XML Programming for Microsoft® .NET now with O’Reilly online learning.

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