ISharedPreferences.GetInt(String, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從偏好設定中取得整數值。
[Android.Runtime.Register("getInt", "(Ljava/lang/String;I)I", "GetGetInt_Ljava_lang_String_IHandler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int GetInt(string? key, int defValue);
[<Android.Runtime.Register("getInt", "(Ljava/lang/String;I)I", "GetGetInt_Ljava_lang_String_IHandler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetInt : string * int -> int
參數
- key
- String
偏好取回的名稱。
- defValue
- Int32
若不存在此偏好,則回傳價值。
傳回
如果偏好值存在,則回傳,或 defValue。 如果有非整數的偏好,則拋出 ClassCastException。
- 屬性
例外狀況
備註
從偏好設定中取得整數值。
Java 文件 android.content.SharedPreferences.getInt(java.lang.String, int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。