Back to results for “Device Features”
.NET MAUI › Local Storage & Data

What is Preferences and when should you use it?

Beginner

Answer

Preferences stores small key-value primitives (strings, numbers, booleans, dates) in platform-native settings storage. Use it for lightweight, non-sensitive app state like the last-selected tab, a theme choice, or a first-run flag. It is not for large or structured data.
Preferences.Default.Set("theme", "dark");
string theme = Preferences.Default.Get("theme", "light");
Real-world example An app remembers the user's chosen theme across launches with a single Preferences key.

Common follow-ups: How is Preferences different from SecureStorage? | What types can it store?