Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the value of preference Preferences in XamarinEssentials

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to set the value of the preference Preferences in XamarinEssentials. It is very detailed and has a certain reference value. Friends who are interested must read it!

If you want to set the value of one of the preferences, you can do so through the Set () method of the Preferences class, which sets the value of the specified key. There are 12 forms of this method, which are introduced in turn below.

(1) the syntax of the Set (string, bool) method is as follows:

Public static void Set (string key, bool value)

(2) the syntax of the Set (string, bool, string) method is as follows:

Public static void Set (string key, bool value, string sharedName)

(3) the syntax of the Set (string, double) method is as follows:

Public static void Set (string key, double value)

(4) the syntax of the Set (string, double, string) method is as follows:

Public static void Set (string key, double value, string sharedName)

(5) the syntax of the Set (string, float) method is as follows:

Public static void Set (string key, float value)

(6) the syntax of the Set (string, float, string) method is as follows:

Public static void Set (string key, float value, string sharedName)

(7) the syntax of the Set (string, int) method is as follows:

Public static void Set (string key, int value)

(8) the syntax of the Set (string, int, string) method is as follows:

Public static void Set (string key, int value, string sharedName)

(9) the syntax of the Set (string, long) method is as follows:

Public static void Set (string key, long value)

(10) the syntax of the Set (string, long, string) method is as follows:

Public static void Set (string key, long value, string sharedName)

(11) the syntax of the Set (string, string) method is as follows:

Public static void Set (string key, string value)

(12) the syntax of the Set (string, string, string) method is as follows:

Public static void Set (string key, string value, string sharedName)

The parameters are described as follows:

Key: keys for preferences

Value: the value of the preference.

SharedName: shared container name.

Note: the following six data types are supported in Preferences:

Bool: Boolean type.

Double: double precision type.

Int: integer.

Float: single precision type.

Long: long integer.

String: string.

[example 1-5] the value of the specified key will be set below. The code is as follows:

Void Preferences_Set (string key, string value)

{

Preferences.Set (key, value) / / sets the value of the specified key

}

The above is all the content of the article "how to set the value of preference Preferences in XamarinEssentials". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report