Code:
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
int[] a = new int[3];
a[0] = 1;
a[1] = 2;
a[2] = 3;
Display(a);
List
list.Add(5);
list.Add(7);
list.Add(9);
Display(list);
Console.ReadLine();
}
static void Display(IList
{
Console.WriteLine("Count: {0}", list.Count);
foreach (int num in list)
{
Console.WriteLine(num);
}
}
}
Output:
Count: 3
1
2
3
Count: 3
5
7
9
More C# Programs: