添加自定义应用程序设置。
<配置>
<appSettings>
<加>
Syntax
<appSettings>
<add key="Key of custom setting" value="Value of custom setting" />
</appSettings>
特性
| Description | |
|---|---|
key |
必需属性。 指定要添加的键的名称。 |
value |
必需属性。 指定要添加的键的值。 |
Parent 元素
| Description | |
|---|---|
| <appSettings> | 包含自定义应用程序设置,例如文件路径、XML Web 服务 URL 或应用程序的任何其他自定义配置信息。 |
子元素
None
Example
以下示例演示如何为应用程序名称添加自定义配置设置:
<appSettings>
<add key="ApplicationName" value="MyApplication" />
</appSettings>
以下示例使用 <add> 元素在 ASP.NET 应用程序中定义两个兼容性设置:
<appSettings>
<add key="AppContext.SetSwitch:Switch.System.Globalization.NoAsyncCurrentCulture" value="true" />
<add key="AppContext.SetSwitch:Switch.System.Uri.DontEnableStrictRFC3986ReservedCharacterSets" value="true" />
</appSettings>