共用方式為


ISharedPreferences.GetStringSet(String, ICollection<String>) Method

Definition

Retrieve a set of String values from the preferences.

[Android.Runtime.Register("getStringSet", "(Ljava/lang/String;Ljava/util/Set;)Ljava/util/Set;", "GetGetStringSet_Ljava_lang_String_Ljava_util_Set_Handler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public System.Collections.Generic.ICollection<string>? GetStringSet (string? key, System.Collections.Generic.ICollection<string>? defValues);
[<Android.Runtime.Register("getStringSet", "(Ljava/lang/String;Ljava/util/Set;)Ljava/util/Set;", "GetGetStringSet_Ljava_lang_String_Ljava_util_Set_Handler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetStringSet : string * System.Collections.Generic.ICollection<string> -> System.Collections.Generic.ICollection<string>

Parameters

key
String

The name of the preference to retrieve.

defValues
ICollection<String>

Values to return if this preference does not exist.

Returns

Returns the preference values if they exist, or defValues. Throws ClassCastException if there is a preference with this name that is not a Set.

Attributes

Remarks

Retrieve a set of String values from the preferences.

Note that you <em>must not</em> modify the set instance returned by this call. The consistency of the stored data is not guaranteed if you do, nor is your ability to modify the instance at all.

Java documentation for android.content.SharedPreferences.getStringSet(java.lang.String, java.util.Set<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