This topic has not yet been rated - Rate this topic

IPersistComponentSettings.SettingsKey Property

Gets or sets the value of the application settings key for the current instance of the control.

Namespace:  System.Configuration
Assembly:  System (in System.dll)
string SettingsKey { get; set; }

Property Value

Type: System.String
A String containing the settings key for the current instance of the control.

Use the SettingsKey property to disambiguate groups of application settings properties when there are multiple instances of the same wrapper class. For example, if a control contains an associated wrapper class, then placing multiple instances of the same control in the same application will typically result in multiple instances of the wrapper class. A settings key is required only when the configuration data differs on a per-instance basis; for example, the location of dynamically positioned controls.

The following general rules apply to the use of SettingsKey:

  • A control, like any class, may contain zero or more application settings classes, derived from ApplicationSettingsBase. Each settings class contains its own ApplicationSettingsBase.SettingsKey property, which helps disambiguate multiple instances of that class.

  • A control should separate its per-instance data and its shared data into different settings classes.

  • For a control with any per-instance configuration data, the get accessor of the SettingsKey property should default to the Name of the control. In most cases the name of the control will be unique within an application. If the control contains only shared configuration data, get should default to null.

  • The set accessor for this property should be implemented to distinguish between settings classes containing per-instance and shared configuration data. For each settings class containing per-instance data, set should just pass-through to the ApplicationSettingsBase.SettingsKey property of the settings class. For settings classes containing shared data, set should perform no action for that settings class.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ