Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 SettingsKey Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
ApplicationSettingsBase..::.SettingsKey Property

Gets or sets the settings key for the application settings group.

Namespace:  System.Configuration
Assembly:  System (in System.dll)
Visual Basic (Declaration)
<BrowsableAttribute(False)> _
Public Property SettingsKey As String
Visual Basic (Usage)
Dim instance As ApplicationSettingsBase
Dim value As String

value = instance.SettingsKey

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

Property Value

Type: System..::.String
A String containing the settings key for the current settings group.

The SettingsKey property is provided to enable client code, and in particular the settings provider, to disambiguate between multiple instances of the same application settings class.

Unless the settings wrapper class is designed using the singleton pattern, there can be multiple instances of the same application settings class in a single application. The value of SettingsKey should be set according to how the property values are intended to be shared.

  • If the settings properties of the wrapper are intended to be shared across all instances of the wrapper in the same application, then SettingsKey should have the same value in all of the instances. This is the default behavior of the ApplicationSettingsBase class.

  • If the settings properties of the wrapper are intended to be per instance, then SettingsKey should have a unique value for every instance. The ApplicationSettingsBase(String) version of the constructor enables you to initialize SettingsKey to a unique string.

In contrast, the Context property provides hints to the settings provider to enable it to persist values in an efficient and orderly manner.

The SettingChangingEventArgs class contains a similar SettingKey property that helps identify the source of the SettingChanging event.

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker