ArrayList Class

The ArrayList class is a weakly-typed collection class. It is found in the System.Collections namespace.

As it is weakly typed, it can contain a heterogeneous collection of elements, that is, of various types.

As a list, it has both a Count (number of elements present) and a Capacity (number of elements the list can contain without resizing). When Count reaches Capacity, Capacity is automatically enlarged.


Constructors: (some of them)

Properties: (some of them)

Indexer:


Methods: (a few of them)


Notes:

There are also methods to sort the ArrayList or to perform a binary search. Sorting requires that the elements should satisfy the IComparer interface (so we need a comparison method).

An ArrayList can contain null values and can have duplicate elements.

For homogeneous elements (all the same type T), an alternative is the List<T> class.

For heterogeneous elements, an alternative is the List<Object> class.