The Below Example Shows How to work with A Generic List Class Which is more powerfull than the ArrayList Class.
Example :
using System;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List< string > names = new List< string >();
names.Add("Hefin");
names.Add("Abbas");
names.Add("Rinso");
names.Add("Freshore");
names.Add("Sachin");
List ID = new List();
ID.Add(1);
ID.Add(2);
ID.Add(3);
ID.Add(4);
}
}
This is an Type Safe Version of an Array List
In This Example the List Object names will accept only string values and The List object ID only accepts Int values.
Regards
Hefin Dsouza