ApplicationSettingsBase.SettingsKey Propriedade

Definição

Obtém ou define a chave de configurações para o grupo de configurações do aplicativo.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

Valor da propriedade

String

Um String que contém a chave de configurações para o grupo de configurações atual.A String containing the settings key for the current settings group.

Atributos

Comentários

A SettingsKey propriedade é fornecida para habilitar o código do cliente e, em particular, o provedor de configurações, para fazer a ambiguidade entre várias instâncias da mesma classe de configurações de aplicativo.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.

A menos que a classe wrapper de configurações seja projetada usando o padrão singleton, pode haver várias instâncias da mesma classe de configurações de aplicativo em um único aplicativo.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. O valor de SettingsKey deve ser definido de acordo com o modo como os valores de propriedade devem ser compartilhados.The value of SettingsKey should be set according to how the property values are intended to be shared.

  • Se as propriedades de configurações do wrapper forem destinadas a serem compartilhadas entre todas as instâncias do wrapper no mesmo aplicativo, SettingsKey o deverá ter o mesmo valor em todas as instâncias.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. Esse é o comportamento padrão da ApplicationSettingsBase classe.This is the default behavior of the ApplicationSettingsBase class.

  • Se as propriedades de configurações do wrapper forem destinadas a serem por instância, o SettingsKey deverá ter um valor exclusivo para cada instância.If the settings properties of the wrapper are intended to be per instance, then SettingsKey should have a unique value for every instance. A ApplicationSettingsBase(String) versão do construtor permite que você inicialize SettingsKey para uma cadeia de caracteres exclusiva.The ApplicationSettingsBase(String) version of the constructor enables you to initialize SettingsKey to a unique string.

Por outro lado, a Context propriedade fornece dicas para o provedor de configurações para permitir que ele persista valores de maneira eficiente e ordenada.In contrast, the Context property provides hints to the settings provider to enable it to persist values in an efficient and orderly manner.

A SettingChangingEventArgs classe contém uma SettingKey Propriedade semelhante que ajuda a identificar a origem do SettingChanging evento.The SettingChangingEventArgs class contains a similar SettingKey property that helps identify the source of the SettingChanging event.

Aplica-se a

Confira também