System.Configuration.DefaultSettingValueAttribute Class

Specifies the default value for an application settings property.

See Also: DefaultSettingValueAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Property)]
public sealed class DefaultSettingValueAttribute : Attribute

Remarks

Note:

System.Configuration.DefaultSettingValueAttribute can only be applied to individual settings properties; it is invalid to apply this attribute to an entire application settings class.

Different settings providers may have different requirements or limitations on the use of the System.Configuration.DefaultSettingValueAttribute. For example, the System.Configuration.LocalFileSettingsProvider does not require this attribute, and will override any value provided by this attribute if there are any values—default or user-modified— already present in the data store.

System.Configuration.DefaultSettingValueAttribute requires that the default value can be represented as a string. As a result, settings using XML serialization cannot have a default value specified by means of this attribute. Some providers may choose to support multiple serialization schemes which can be specified at compile time using the System.Configuration.SettingsSerializeAsAttribute.

Note:

The default values specified by this attribute are stored as plain text in the resultant compiled .exe or .dll file. Therefore these default values are inherently insecure.

Requirements

Namespace: System.Configuration
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0