如何在设置文件中保存对象列表? [英] How Can I Save a List of objects in setting file?

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

问题描述

我想在 C# Winform 的设置文件"中保存对象列表.我可以使用列表字典,但它是一对(键,值)列表.如何在资源文件中保存列表或集合 (IEnumberable)?

I Want to save a list of objects in 'setting file' in C# Winform. I can use List Dictionary but its a pair (key,value) list. How can I save a list or collection (IEnumberable) in Resource file?

推荐答案

您可以搜索其他集合,您不限于显示的内容,我知道的唯一限制是使用通用集合.你总是可以使用 ArrayList 或者有一个 StringCollection 可用.您可以通过单击浏览然后导航到 mscorlib --> 来访问它们.System.Collections -->ArrayListSystem -->System.Collections.Specialized -->字符串集合.但由于您需要一个对象,我可能会使用 ArrayList 因为在这种情况下,泛型似乎不是一个选项.

You can can do a search for additional collections, you are not limited to what is shown the only limitations that I know of is the use of a generic collection. You can always use an ArrayList or there is a StringCollection available. You can get to them by clicking the browse then navigating to mscorlib --> System.Collections --> ArrayList or System --> System.Collections.Specialized --> StringCollection. But since you are needing an object I would probably use the ArrayList since it appears that Generics are not an option in this situation.

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

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