Visual Basic/Collections

Collection class provides an array-like container more flexible than an array in some ways and less flexible in other ways. More flexible in some ways than Collection is Dictionary class.

Creating a new collection:

Dimensioning and creating a new collection in one line:

Adding an item:

Accessing an item at an index, in a read-only way:

Overwriting a item at an index:

Removing an item:

The size of a collection:

Iterating over a collection, read-only:

Iterating over a collection, read-write:

Testing the emptiness of a collection:

Testing the presence of an element in a collection:

Appending one collection to another:

Converting a collection to an array:

Using a collection as a queue:

Using a collection as a stack:

Using a collection as a set: