0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Xamarin] アプリ内に簡単な値を保存

Posted at

アプリ内ストレージに簡単な値を保存しておく場合、ブラウザーのクッキー的な存在で使う例。

こちらを参照しました。
https://docs.microsoft.com/en-us/xamarin/essentials/preferences?context=xamarin%2Fxamarin-forms&tabs=android

Essentials

Eseentials ライブラリーを参照

using Xamarin.Essentials;

書込み

Preferences.Set("my_key", "my_value");

読込

var myValue = Preferences.Get("my_key", "default_value");

何もないときは default_valueを返します

削除

Preferences.Remove("my_key");

すべての値を削除

Preferences.Clear();

書込み可能な変数タイプ

  • bool
  • double
  • int
  • float
  • long
  • string
  • DateTime
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?