集合与数组 [英] Collections vs Arrays

查看:69
本文介绍了集合与数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我需要帮助确定存储多件物品的最佳方法。


例如,我正在创建列表框和列表框中的每个项目都需要具有属性。我不想使用数组,因为我不会知道列表框中的最大项目。我在微软的网站上简要阅读了关于集合的内容。但我不太明白它们是如何被使用的。有人能举例说明我会做什么代码。


谢谢!

Hello,

I need help determining what the best way to store properties of multiple items.

For example, I am creating a list box and every item in the list box needs to have properties. I don''t want to use arrays because I''m not going to know the maximum items in the list box. I read briefly on Microsoft''s site about "collections" but I don''t quite understand how they are used. Can someone give me an example of what I would do as far as code.

Thanks!

推荐答案

集合是最好的解决方案。


你只需要创建一个使用定义类型并使用它。
collection is the best solution for your case.

you just need to create an use defined type and use that.


我不知道如何使用集合,你能给我一些代码示例吗?
I''m not sure how to use collections, can you give me some code examples??


这是如何使用一个集合或列表


[代码]


将myList调暗为新列表(字符串)


myList.Add(&Something)

myList.Add(其他东西,无论大小是多少)


/ [code]


告诉我,如果这个帮助你
This is how to use a collection or list of


[code]

Dim myList as new List(Of String)

myList.Add("Something")
myList.Add("Other thing no matter what the size is")

/[code]

Tell me if this help you


这篇关于集合与数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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