How to use Count and Clear() :

class Program
{
static void Main()
{
ArrayList list = new ArrayList();
list.Add(3);
list.Add(8);

list.Add(10);
list.Add(52);

Console.WriteLine(list.Count);  // Show number of element in ArrayList and output=4
list.Clear();                               // Clear all the elements of ArrayList.

Console.WriteLine(list.Count);   // Again count the number of element.
Console.ReadLine();                  // Output = 0
}
}

———————–*———————–

Leave a Reply