Search

ArrayList in c#

the ArrayList is a collection found in System.Collections and it can store objects of any derived type. You don't need to worry about the type of the elements, at least until you need to use them.
using System;
using System.Collections;

class Program
{
    static void Main()
    {
 ArrayList list = new ArrayList();
 list.Add("cat");
 list.Add(2);
 list.Add(false);

 foreach (var element in list)
 {
     Console.WriteLine(element);
 }
    }
}