C# ArrayList ArrayList()

Description

ArrayList ArrayList() initializes a new instance of the ArrayList class that is empty and has the default initial capacity.

Syntax

ArrayList.ArrayList() has the following syntax.


public ArrayList()

Example

The following code demonstrates the 3 constructors of ArrayList.


using System;/* ww  w. j  a v a2  s.c o m*/
using System.Collections;

class Class1
{
  static void Main(string[] args)
  {
           ArrayList al1 = new ArrayList();
           ArrayList al2 = new ArrayList( 10 );

           int[] intArr = new int[10];
           ArrayList al3 = new ArrayList( intArr );

           ArrayList myArrayList = new ArrayList();
           myArrayList.Capacity = 10;

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack