Friday, July 8, 2022

Storage options in .NET MAUI

 .NET MAUI provides multiple storage options for caching data locally on a device.

The three most commonly used options for storing data locally in a .NET MAUI app are:

  • Preferences: Stores data in key-value pairs
  • File system: Stores loose files directly on the device through file system access
  • Database: Stores data in a relational database
Preferences are convenient when you're working with simple pieces of data, such as user selections.
bool bUserDetails = ...; ... Preferences.Set("UserDetails", bUserDetails); ... var savedPreference = Preferences.Get("UserDetails", false);

The Preferences class also contains methods for determining whether a named preference exists (ContainsKey), deleting a preference (Remove), and removing all preference data (Clear).

No comments:

Post a Comment

Cloud Service Model

Iaas: Infrastcture as s service This cloud service model is the closest to managing physical servers; a cloud provider will keep the hardwar...