
Implements the IList interface using an array whose size is dynamically increased as required.
Assembly: mscorlib (in mscorlib.dll)
The ArrayList is not guaranteed to be sorted. You must sort the ArrayList prior to performing operations (such as BinarySearch) that require the ArrayList to be sorted.
The capacity of a ArrayList is the number of elements the ArrayList can hold. As elements are added to an ArrayList, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly.
Elements in this collection can be accessed using an integer index. Indexes in this collection are zero-based.
The ArrayList collection accepts Nothing as a valid value, allows duplicate elements.
Using multidimensional arrays as elements in an ArrayList collection is not supported.
The following code example shows how to create and initialize an ArrayList and how to print out its values.
Imports System Imports System.Collections Imports Microsoft.VisualBasic Public Class SamplesArrayList Public Shared Sub Main() ' Creates and initializes a new ArrayList. Dim myAL As New ArrayList() myAL.Add("Hello") myAL.Add("World") myAL.Add("!") ' Displays the properties and values of the ArrayList. Console.WriteLine("myAL") Console.WriteLine(" Count: {0}", myAL.Count) Console.WriteLine(" Capacity: {0}", myAL.Capacity) Console.Write(" Values:") PrintValues(myAL) End Sub Public Shared Sub PrintValues(myList As IEnumerable) Dim obj As [Object] For Each obj In myList Console.Write(" {0}", obj) Next obj Console.WriteLine() End Sub 'PrintValues End Class ' This code produces output similar to the following: ' ' myAL ' Count: 3 ' Capacity: 4 ' Values: Hello World !
System.Collections.ArrayList
System.Windows.Forms.DomainUpDown.DomainUpDownItemCollection
Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
An ArrayList can support multiple readers concurrently, as long as the collection is not modified. To guarantee the thread safety of the ArrayList, all operations must be done through the wrapper returned by the Synchronized method.
Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.See:
http://msdn.microsoft.com/en-us/library/512aeb7t.aspx

- 6/6/2010
- H-ArnoldG
