Uredi

Deli z drugimi prek


App Settings schema

Contains custom application settings, such as file paths, XML Web service URLs, or any other custom configuration information for an application.

<configuration>
  <appSettings>
    <add>
    <clear>
    <remove>

Element Description
<appSettings> Contains <add>, <clear>, and <remove> tags to control application settings. Has an optional file attribute.
<add> Defines a setting. Child of <appSettings>. Requires key and value attributes.
<clear> Clears all settings. Child of <appSettings>. Has no attributes.
<remove> Removes a setting. Child of <appSettings>. Requires a key attribute.

<appSettings> element

This element contains <add>, <clear>, and <remove> tags to control application settings. It defines an optional attribute for file.

<add> element

Adds a custom application setting as a name/value pair to the application settings collection. It defines attributes for key and value.

<clear> element

Removes all references to inherited custom application settings and allows only the references that are added by <add> elements following the <clear> element. It defines no attributes.

<remove> element

Removes a reference to an inherited custom application setting from the application settings collection. It defines an attribute for key.

Example

The following example shows an external application settings file (custom.config) that defines a custom application setting:

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
  <add key="MyCustomSetting" value="MyCustomSettingValue" />
</appSettings>

The following example shows an application configuration file that consumes the setting in the external settings file and sets an application setting of its own:

<configuration>
  <appSettings file="custom.config">
    <add key="ApplicationName" value="MyApplication" />
  </appSettings>
</configuration>

See also