如何将列表中的数组保存到文件中 [英] how to save array in the list to file

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

问题描述

所以我的程序停留在这个级别我不知道如何在列表中保存数组文件

我的意思是这样的保存列表



list =({Car,Bicycle,Truck},{Flour,Tea,Cheese})以及更多

所以当我将它保存到列表然后我加载它我可以返回字符串像



So my program is stuck at this level I don't know how to save array in the list to file
what I mean is save list like this

list = ({"Car", "Bicycle", "Truck"}, {"Flour", "Tea", "Cheese"}) and more
so when I save it to the list then I load it I can return the string like

list = ({"Car", "Bicycle", "Truck"}, {"Flour", "Tea", "Cheese"})
list(0)
#and it will return {"Car", "Bicycle", "Truck"}
list(0)(2)
#Truck
list(1)
#{"Flour", "Tea", "Cheese"}
list(1)(0)
#Flour







Dim list As New List(Of String())
list.add({"Car", "Bicycle", "Truck"})
list.add({"Flour", "Tea", "Cheese"})
#and save it to the file





或类似的东西,

这个人能帮助我吗?也许使用my.settings和.ini或类似的东西



or something like,
this anyone can help me ? maybe with my.settings and .ini or something like that

推荐答案

可以有许多不同的方法来保存数据。如果基于一些常规方法,这称为序列化 http://en.wikipedia.org/wiki /序列化 [ ^ ]。



选择序列化的方法是什么?基于数据合同,我强烈建议这一点: http://en.wikipedia.org/wiki /序列化 [ ^ ]。



-SA
There can be many different ways to persist data. If based on some regular approach, this is called serialization: http://en.wikipedia.org/wiki/Serialization[^].

What approach to serialization to choose? I would strong advice this one, based on data contracts: http://en.wikipedia.org/wiki/Serialization[^].

—SA


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

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