.NET Framework Class Library
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)
Syntax

Visual Basic (Declaration)
Property SettingsKey As String
Visual Basic (Usage)
Dim instance As IPersistComponentSettings
Dim value As String

value = instance.SettingsKey

instance.SettingsKey = value
C#
string SettingsKey { get; set; }
Visual C++
property String^ SettingsKey {
    String^ get ();
    void set (String^ value);
}
JScript
function get SettingsKey () : String
function set SettingsKey (value : String)

Property Value

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

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 nullNothingnullptra null reference (Nothing in Visual Basic).

  • 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.

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0
See Also

Reference

Other Resources

Tags :


Page view tracker