The Collection object allows you to dynamically group a family of objects, identified by index.
The Collection object has only one property:
- Count — returns the number of elements in the collection.
It also has three methods, described in Table.
TableMethods of the Collection Object
| Method | Description |
| Add | Adds a new element to the collection. |
| Add item [, key, before, after] | Here: |
- item — required parameter, specifies the element to be added.
- key — optional parameter, identifies the element (can be used instead of its index).
- before — optional parameter, specifies the element before which the new element is inserted.
- after — optional parameter, specifies the element after which the new element is inserted. |
| Item | Returns the specified element of the collection. |
| Item(index) | index is the element’s index in the collection or its identifier defined by the key parameter in the Add method. Numbering in a Collection begins with 1. |
| Remove | Removes an element from the collection. |
| Remove index | index is the element’s index in the collection or its identifier defined by the key parameter in the Add method. |