如何在 Xamarin Forms 中存储列表? [英] How can I store lists in Xamarin Forms?

查看:25
本文介绍了如何在 Xamarin Forms 中存储列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 Xamarin Forms 本地存储列表?

Is there a way to store lists natively using Xamarin Forms?

推荐答案

在设置插件中,您可以以键值方式存储,因此您不能直接存储列表.一种解决方法是,您可以将您的列表序列化为一个 json 字符串,然后您可以使用一个键来存储它.当您需要返回列表时,您可以使用密钥获取该 json 字符串并将其反序列化为原始格式.

In settings Plugin you can store in a key-value fashion, so you can not directly store lists. A workaround can be, you can serialize your list into a json string, and you can store that using a key. And when you need the list back, you can get that json string using the key and deserialize it to the original format.

这篇关于如何在 Xamarin Forms 中存储列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆