Create an ArrayList from another ArrayList in CSharp

Description

The following code shows how to create an ArrayList from another ArrayList.

Example


using System;//  ww  w  .  j  a  va  2  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 );

           Console.WriteLine(al3.Count);
           Console.WriteLine(al3.Capacity);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary