This class is similar to an array, but it can grow or shrink as needed. The Capacity property returns the maximum number of elements the ArrayList can hold. You can reduce the size by setting Capacity explicitly or using the TrimToSize() method. An ArrayList can be constructed empty or with an integer argument that sets its initial size. You can also pass the constructor an object that implements ICollection to fill the ArrayList with the contents of that object.

A number of methods are provided to modify the contents of the ArrayList. The Add() and AddRange() methods add elements to the end of the list. Insert() and InsertRange() add new elements at a specified location within the list.

Public Class ArrayList : Implements IList, ICollection, IEnumerable, ICloneable
' Public Constructors
   Public Sub New() 
   Public Sub New( ByVal c As ICollection) 
   Public Sub New( ByVal capacity As Integer) 
' Public Instance Properties
   Overridable Public Property Capacity As Integer  
   Overridable Public ReadOnly Property Count As Integer 
   Implements ICollection.Count 
   Overridable Public ReadOnly Property IsFixedSize As Boolean Implements IList.IsFixedSize 
   Overridable Public ReadOnly Property IsReadOnly As Boolean Implements IList.IsReadOnly 
   Overridable Public ReadOnly Property IsSynchronized As Boolean Implements ICollection.IsSynchronized 
   Overridable Public Default Property Item(
        ByVal index As Integer) As Object Implements IList.Item 
   Overridable Public ReadOnly Property SyncRoot ...

Get VB.NET Core Classes in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.