Use of “for loop” to show the elements of an ArrayList :

class Program
{
static void Main()
{
ArrayList list = new ArrayList();
list.Add(“Imrez”);
list.Add(“Khan”);
list.Add(“Ratin”);

for(int i=0; i<list.Count;i++)
{
string value = list[i].ToString();
Console.WriteLine(value);
Console.ReadLine();
}

}
}

Output :
Imrez
Khan
Ratin

Leave a Reply