Advertisement
Beginner .NET MAUI, Local Storage & Data

What is Preferences and when should you use it?

Short 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.

Save .NET MAUI mock interview
Advertisement
AModel 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.
Likely follow-ups
  • How is Preferences different from SecureStorage? | What types can it store?
Related topics