Specifying the type of ArrayList's elements

.net, c#, generics

Solution

`List<T>` was introduced with generics in .NET 2.0:

using System.Collections.Generic;

var list = new List<int>();
list.Add(1);
list.Add("string"); //compile-time error!
int i = list[0];

Problem

I thought that there was some way in .net 3.0 to give an array list a type so that it didnt just return Object's but I'm having trouble doing so. Is it possible? If so, how?

Original source