Partager via


Preference.Key Property

Definition

Gets the key for this Preference, which is also the key used for storing values into SharedPreferences or PreferenceDataStore. -or- Sets the key for this Preference, which is used as a key to the SharedPreferences or PreferenceDataStore.

public virtual string? Key { [Android.Runtime.Register("getKey", "()Ljava/lang/String;", "GetGetKeyHandler")] get; [Android.Runtime.Register("setKey", "(Ljava/lang/String;)V", "GetSetKey_Ljava_lang_String_Handler")] set; }
[<get: Android.Runtime.Register("getKey", "()Ljava/lang/String;", "GetGetKeyHandler")>]
[<set: Android.Runtime.Register("setKey", "(Ljava/lang/String;)V", "GetSetKey_Ljava_lang_String_Handler")>]
member this.Key : string with get, set

Property Value

The key.

Attributes

Remarks

Property getter documentation:

Gets the key for this Preference, which is also the key used for storing values into SharedPreferences or PreferenceDataStore.

Java documentation for android.preference.Preference.getKey().

Property setter documentation:

Sets the key for this Preference, which is used as a key to the SharedPreferences or PreferenceDataStore. This should be unique for the package.

Java documentation for android.preference.Preference.setKey(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to