Issue
I have recently started using the Xamarin Essentials and I personally love the work the team has done on the package.
I was just going through the documents for the same i.e. and I got Across the Preferences API which look slick and work well too.
But what I would personally like to know is what is the actual difference between the Preferences API and the Xamarin Forms Application Properties.
From my research, as of now, Properties
is an IDictionary<string,object>
Whereas Preferences is a class that uses the native SharedPreferences
and NSUserDefaults
to store data. Now both of them provide the ability to keep persistent properties.
But the documentation doesn't seem to provide me with any ideas as to when I should use which among them.
Also the Xamarin Essentials one highlights a limitation that:
When storing a string, this API is intended to store small amounts of text. Performance may be subpar if you try to use it to store large amounts of text.
Whereas Application Properties do not have anything as such as you can find here https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.application.properties?view=xamarin-forms
Is there anything else that I am missing?
Solution
Application.Properties
Serializes your data and store it in a file on each platform native file system using dependency service. Here is code the from repo
While Preferences API uses platform specific persistent mechanism i.e User Preference
in android and User Defaults
in iOS
Answered By - Fahadsk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.