VB.NET Collections

Array Collections File Keyword String Cast Class Console Data Directive Enum Exception If Interface Lambda LINQ Loop Nothing Number Process Property Regex Select Sort StringBuilder Structure Sub Time Windows

Set

Collections. A collection contains reference to other objects. We combine many class instances and values together.
We construct models,
built of objects,
that mirror real-world problems.


List

List. We often need to store many elements in a resizable array. We might not even know how many elements are going to be added. List here is useful.

ListSortFindBinarySearchRemove Duplicates
ArrayList

ArrayList. An ArrayList is an older version of the List type. It is not a generic collection. It is slower and may be harder to use. But older programs are also important.

ArrayList
Dictionary

Dictionary. If we have a large collections of elements and want to find one fast, Dictionary is an ideal solution. We perform lookups. Dictionary uses hash codes to locate elements.

DictionaryDictionary SortTryGetValue
KeyValuePair: Key and Value properties

KeyValuePair. This is a Structure. It contains a Key and a Value. These two items can have any type, but they cannot be modified once created.

KeyValuePair
Hash

Hashtable. This is an older version of the Dictionary.
It also computes hash codes
and performs lookups,
but it requires casting. Its syntax is more complex.

Hashtable
Tuple

Types. These implement special algorithms, changing the order of insertion and removal. Some of these are generics (HashSet, Queue, Stack, Tuple).

HashSetQueueStackTuple
Convert

Convert. We often need to convert collections. This requires knowledge of available functions. And sometimes custom methods are required. But many built-in methods also exist.

ToArrayToDictionaryToListArrayList to ArrayDictionary to ListList to Array
The VB.NET programming language

Collections are useful in nearly every program. The built-in collections are powerful, fast and complete. The most modern ones are found in System.Collections.Generic.

VB.NET