ApplicationSettingsBase.SettingsKey Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the settings key for the application settings group.
public:
property System::String ^ SettingsKey { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
public string SettingsKey { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SettingsKey : string with get, set
Public Property SettingsKey As String
Property Value
A String containing the settings key for the current settings group.
- Attributes
Remarks
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.
Applies to
See also
.NET