Modifier

Partager via


ApplicationSettingsBase Constructors

Definition

Initializes an instance of the ApplicationSettingsBase class.

Overloads

ApplicationSettingsBase()

Initializes an instance of the ApplicationSettingsBase class to its default state.

ApplicationSettingsBase(IComponent)

Initializes an instance of the ApplicationSettingsBase class using the supplied owner component.

ApplicationSettingsBase(String)

Initializes an instance of the ApplicationSettingsBase class using the supplied settings key.

ApplicationSettingsBase(IComponent, String)

Initializes an instance of the ApplicationSettingsBase class using the supplied owner component and settings key.

ApplicationSettingsBase()

Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs

Initializes an instance of the ApplicationSettingsBase class to its default state.

protected:
 ApplicationSettingsBase();
protected ApplicationSettingsBase ();
Protected Sub New ()

Remarks

The parameterless constructor was designed to work under the assumption that there is no component associated with the current settings wrapper class, which derives from ApplicationSettingsBase.

When an instance of a wrapper class is created, inherited code will automatically perform the following actions:

  1. Reflect over the class.

  2. For each property on the wrapper marked with either [UserScopedSettingAttribute] or [ApplicationScopedSettingAttribute], a corresponding SettingsProperty is created.

  3. Each SettingsProperty has some of its properties set based on other attributes that are optionally present on the wrapper's properties, such as the default value or the settings provider.

  4. All other attributes are simply put into an attribute bag, the Attributes property of the SettingsProperty class.

  5. All SettingsProperty objects are added to a SettingsPropertyCollection represented by the Properties property of the ApplicationSettingsBase class. This collection is then passed to the Initialize method.

As implied by step 3 mentioned previously, ApplicationSettingsBase natively works with several property attributes, specifically the following: SettingsProviderAttribute, DefaultSettingValueAttribute, and SettingsSerializeAsAttribute. All other settings attributes are simply passed through to the appropriate underlying provider.

See also

Applies to

ApplicationSettingsBase(IComponent)

Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs

Initializes an instance of the ApplicationSettingsBase class using the supplied owner component.

protected:
 ApplicationSettingsBase(System::ComponentModel::IComponent ^ owner);
protected ApplicationSettingsBase (System.ComponentModel.IComponent owner);
new System.Configuration.ApplicationSettingsBase : System.ComponentModel.IComponent -> System.Configuration.ApplicationSettingsBase
Protected Sub New (owner As IComponent)

Parameters

owner
IComponent

The component that will act as the owner of the application settings object.

Exceptions

owner is null.

Remarks

This constructor is exactly equivalent to the ApplicationSettingsBase(IComponent, String) constructor using the invocation:

ApplicationSettingsBase(owner, String.Empty)

For information about how reflection is used during the instantiation of a wrapper class, see the default ApplicationSettingsBase() constructor.

See also

Applies to

ApplicationSettingsBase(String)

Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs

Initializes an instance of the ApplicationSettingsBase class using the supplied settings key.

protected:
 ApplicationSettingsBase(System::String ^ settingsKey);
protected ApplicationSettingsBase (string settingsKey);
new System.Configuration.ApplicationSettingsBase : string -> System.Configuration.ApplicationSettingsBase
Protected Sub New (settingsKey As String)

Parameters

settingsKey
String

A String that uniquely identifies separate instances of the wrapper class.

Remarks

This constructor initializes the SettingsKey property to the value of the settingsKey parameter. This property is useful in disambiguating different instances of the settings wrapper class in the same application domain.

For information about how reflection is used during the instantiation of a wrapper class, see the default ApplicationSettingsBase() constructor.

See also

Applies to

ApplicationSettingsBase(IComponent, String)

Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs
Source:
ApplicationSettingsBase.cs

Initializes an instance of the ApplicationSettingsBase class using the supplied owner component and settings key.

protected:
 ApplicationSettingsBase(System::ComponentModel::IComponent ^ owner, System::String ^ settingsKey);
protected ApplicationSettingsBase (System.ComponentModel.IComponent owner, string settingsKey);
new System.Configuration.ApplicationSettingsBase : System.ComponentModel.IComponent * string -> System.Configuration.ApplicationSettingsBase
Protected Sub New (owner As IComponent, settingsKey As String)

Parameters

owner
IComponent

The component that will act as the owner of the application settings object.

settingsKey
String

A String that uniquely identifies separate instances of the wrapper class.

Exceptions

owner is null.

Remarks

The IComponent object specified by the owner parameter acts as the owner of the current instance of this applications settings class. During the initialization of the settings wrapper class derived from ApplicationSettingsBase, the owner's site is queried for a ISettingsProviderService. If one exists, it is used in preference to native settings provider for all the properties of the wrapper class, as specified by the SettingsProviderAttribute.

This constructor initializes the SettingsKey property to the value of the settingsKey parameter. This property is useful in disambiguating different instances of the wrapper class in the same application domain.

For information about how reflection is used during the instantiation of a wrapper class, see the default ApplicationSettingsBase() constructor.

See also

Applies to