当前位置:K88软件开发文章中心编程语言.NET.NET02 → 文章内容

VB.Net - 集合

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-15 15:59:01

由 yiyohunter 创建,youj 最后一次修改 2016-12-12 集合类是用于数据存储和检索的专用类。 这些类提供对堆栈,队列,列表和哈希表的支持。 大多数集合类实现相同的接口。 集合类用于各种目的,例如动态地为元素分配内存以及基于索引访问项目列表等。这些类创建Object类的对象集合,Object类是VB中所有数据类型的基类 。各种集合类和它们的用法以下是System.Collection命名空间的各种常用类。 单击以下链接以检查其详细信息。 ClassDescription and UseageArrayListIt represents ordered collection of an object that can be indexedindividually.它表示可以单独索引的对象的有序集合。It is basically an alternative to an array. However, unlike array, you can add and remove items from a list at a specified position using anindex and the array resizes itself automatically. It also allows dynamic memory allocation, add, search and sort items in the list.它基本上是一个数组的替代。 但是,与数组不同,您可以使用索引在指定位置从列表中添加和删除项目,并且数组会自动调整大小。 它还允许动态内存分配,添加,搜索和排序列表中的项目。HashtableIt uses a key to access the elements in the collection.它使用一个键来访问集合中的元素。A hash table is used when you need to access elements by using key, and you can identify a useful key value. Each item in the hash table has a key/value pair. The key is used to access the items in the collection.当您需要通过使用键访问元素时使用散列表,您可以标识有用的键值。 散列表中的每个项都有一个键/值对。 该键用于访问集合中的项目。SortedListIt uses a key as well as an index to access the items in a list.它使用一个密钥以及索引来访问列表中的项目。A sorted list is a combination of an array and a hash table. It contains a list of items that can be accessed using a key or an index. If you access items using an index, it is an ArrayList, and if you access items using a key, it is a Hashtable. The collection of items is always sorted by the key value.排序的列表是数组和哈希表的组合。它包含可以使用的键或索引访问的项的列表。如果您访问使用索引的项目,它是一个 ArrayList,和如果你访问项目使用一把钥匙,它是一个哈希表。项的集合总是按关键值排序的。StackIt represents a last-in, first out collection of object.它表示对象的后进先出的集合。It is used when you need a last-in, first-out access of items. When you add an item in the list, it is called pushing the item, and when you remove it, it is calledpopping the item.当您需要项目的最后进入,首先访问时使用。 当您在列表中添加项目时,称为推送项目,当您删除它时,它被称为弹出项目。QueueIt represents a first-in, first out collection of object.它表示对象的先进先出集合。It is used when you need a first-in, first-out access of items. When you add an item in the list, it is called enqueue, and when you remove an item, it is called deque.当您需要项目的先进先出访问时使用。 当您在列表中添加项目时,它被称为enqueue,当您删除项目时,称为deque。BitArrayIt represents an array of the binary representation using the values 1 and 0.它表示使用值1和0的二进制表示的数组。It is used when you need to store the bits but do not know the number of bits in advance. You can access items from the BitArray collection by using an integer index, which starts from zero.它用于需要存储位但不提前知道位数。 您可以通过使用从零开始的整数索引来访问BitArray集合中的项目。

VB.Net - 集合