using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List
oyears.Add(1990);
oyears.Add(1991);
oyears.Add(1992);
oyears.Add(1993);
oyears.Add(2001);
oyears.Add(2002);
oyears.Add(2003);
foreach (int item in oyears)
{
Console.WriteLine(item);
}
Console.ReadKey();
}
}

VulpesPosted Nov 24, 2014, 6:56 AM
This means that you can replace the 'type parameter', T, with any actual type and it will then give you a list of that type.
So List
Generic types save code and reduce complication. If we didn't have them and you wanted a llst of bool say, then you'd have to create a separate class for that even though the code would essentially be just the same as for a list of int.
MahaPosted Nov 24, 2014, 7:00 AM