c# – ArrayList example

by Jeff Fillegar on January 14, 2012


using System;
using System.Collections;
using System.Diagnostics;

class Program
{
static void Main()
{
//
// Create an ArrayList and add two ints.
//


ArrayList list = new ArrayList();
list.Add(5);
list.Add(7);

//
// Use ArrayList with method.
//

Example(list);
}

static void Example(ArrayList list)
{
foreach (int i in list)
{
Debug.WriteLine(i);
Console.WriteLine(i);
}
}
}

Output

5
7

Leave a Comment

Previous post:

Next post: