Share via


Application Settings Attributes

The Application Settings architecture provides many attributes that can be applied either to the applications settings wrapper class or its individual properties. These attributes are examined at run time by the application settings infrastructure, often specifically the settings provider, in order to tailor its functioning to the stated needs of the custom wrapper.

The following table lists the attributes that can be applied to the application settings wrapper class, this class's individual properties, or both. By definition, only a single scope attribute—UserScopedSettingAttribute or ApplicationScopedSettingAttribute—must be applied to each and every settings property.

Note

A custom settings provider, derived from the SettingsProvider class, is only required to recognize the following three attributes: ApplicationScopedSettingAttribute, UserScopedSettingAttribute, and DefaultSettingValueAttribute.

Attribute

Target

Description

SettingsProviderAttribute

Both

Specifies the short name of the settings provider to use for persistence.

If this attribute is not supplied, the default provider, LocalFileSettingsProvider, is assumed.

UserScopedSettingAttribute

Both

Defines a property as a user-scoped application setting.

ApplicationScopedSettingAttribute

Both

Defines a property as an application-scoped application setting.

DefaultSettingValueAttribute

Property

Specifies a string that can be deserialized by the provider into the hard-coded default value for this property.

The LocalFileSettingsProvider does not require this attribute, and will override any value provided by this attribute if there is a value already persisted.

SettingsDescriptionAttribute

Property

Provides the descriptive test for an individual setting, used primarily by run-time and design-time tools.

SettingsGroupNameAttribute

Class

Provides an explicit name for a settings group. If this attribute is missing, ApplicationSettingsBase uses the wrapper class name.

SettingsGroupDescriptionAttribute

Class

Provides the descriptive test for a settings group, used primarily by run-time and design-time tools.

SettingsManageabilityAttribute

Both

Specifies zero or more manageability services that should be provided to the settings group or property. The available services are described by the SettingsManageability enumeration.

SpecialSettingAttribute

Property

Indicates that a setting belongs to a special, predefined category, such as a connection string, that suggests special processing by the settings provider. The predefined categories for this attribute are defined by the SpecialSetting enumeration.

SettingsSerializeAsAttribute

Both

Specifies a preferred serialization mechanism for a settings group or property. The available serialization mechanisms are defined by the SettingsSerializeAs enumeration.

NoSettingsVersionUpgradeAttribute

Property

Specifies that a settings provider should disable all application upgrade functionality for the marked property.

Class indicates that the attribute can be applied only to an application settings wrapper class. Property indicates that the attribute can be applied only settings properties. Both indicates that the attribute can be applied at either level.

See Also

Tasks

How to: Create Application Settings Using the Designer

Concepts

Application Settings Architecture

Reference

ApplicationSettingsBase

SettingsProvider