retrieve arraylist items using indexers

The Count property of the ArrayList indicates the size of the arrayList. We can use the value to loop through the ArrayList.

private void Form1_Load(object sender, EventArgs e)
{
	ArrayList arrayList = new ArrayList();
	arrayList.Add("Customer1");
	arrayList.Add("Customer2");
	arrayList.Add("Customer3");
	arrayList.Add("Customer4");
	arrayList.Add("Customer5");

	//Iterating through items - Using Indexers 
	for (int i = 0; i < arrayList.Count; i++)
	{
		str += arrayList[i].ToString() + "\n";
	}
	MessageBox.Show(str);