This example shows you How to use ArrayList in C#. ArrayList is one of the most flexible data structure of Collections.

As you know, ArrayList implements IList interface. So very easy to add, insert, delete, view and so on.

public void DotNetExamples()
    ArrayList arrayList = new ArrayList();
    arrayList.Add(new Customer());
    foreach (object item in arrayList)
        //Do something

As you can see, you can add any kind of data type to the ArrayList. To get item in ArrayList you can use for or foreach loop.

ArrayList also provides methods that let you easily Insert, Delete, Sort, Count ... etc