Create an ArrayList that is empty and has the default initial capacity in CSharp

Description

The following code shows how to create an ArrayList that is empty and has the default initial capacity.

Example


using System;//ww  w  .j a  v  a  2s  .c  om
using System.Collections;

class Class1
{
  static void Main(string[] args)
  {
           ArrayList al = new ArrayList();
           Console.WriteLine(al.Count);
           Console.WriteLine(al.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