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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.