Header Ads

arraylist program in c#(generics)

using System;
using System.Collections;

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)
{
Console.WriteLine(i);
}
}
}

Powered by Blogger.