1
Reply

What is the difference between ArrayList and List in C#.Net?

    ArrayListArraylist is used to store any type of data there is no restriction that mean we can store integer or string or any object based on our requirements. If we want to use ArrayList in our applications we need to add System.Collections namespace and ArrayList was introduced in .NET 2.0 framework.C# Codeusing System.Collections; ArrayList arylist = new ArrayList(); arylist.Add("Suresh Dasari"); arylist.Add("aspdotnet-suresh.com"); arylist.Add(2046); arylist.Add(DateTime.Now);*************************************************************************** Generic List (List)Generic lists are the type safe objects because it will store only specified datatype of elements. The Generic List declaration will be like List here T means datatype i.e. either string, integer, etc.If we want to use Generic List in our applications we need to add System.Collections.Generic namespace and Generic List was introduced in .NET 3.0 framework.C# Codeusing System.Collections.Generic; List lst = new List(); lst.Add(232); lst.Add(534); lst.Add(2046);