Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
lawrence_shaun_introducing_net_maui_build_and_deploy_crosspl.pdf
Скачиваний:
46
Добавлен:
26.06.2023
Размер:
5.15 Mб
Скачать

Chapter 9 Local Data

•\ File system: Stores loose files directly on the device through file system access

•\ Database: Stores data in a file optimized for access •\ Preferences: Stores data in key-value pairs

•\ Secure storage: Stores data in key-value pairs like preferences but stores them in a secure location on the device

File System

.NET MAUI provides some helpful abstractions over the multiple platforms that it supports. One such abstraction is the FileSystem helper class. It comes from the old Xamarin.Essentials library and now is a core part of

.NET MAUI. It allows you to obtain useful bits of information to help with common tasks involving the file system.

Let’s take a look at the properties the FileSystem class offers you as it helps to know when they should be used and for what type of data.

Cache Directory

You have no need to cache anything as part of the application we’re building in this book; however, I feel this is a valuable piece of information to mention. This property enables you to get the most appropriate location to store cache data. You can store any type of data in this directory. Typically you store it when you want to persist it longer than just holding it in memory. Your application should not rely on this data to function because the operating system can and will clear this storage down.

260