Generics in C#

This blog shows on  how to use Generics in C#.

public virtual int Add(object value);
public virtual object this[int index] {get; set;}

System.ollections.ArrayList list = new System.Collections.ArrayList();

list.Add("a string");
list.Add(45); //no exception thrown
list.Add(new System.Collections.ArrayList()); //no exception

foreach(string s in list) { //exception will be thrown!
  System.Console.WriteLine(s);
}

Next Recommended Reading Generic vs Non Generic collections