Arraylist vs genericlist List<> in .net 2.0
Arraylist vs Genericlist List<> in .net 2.0:
Arraylist:
- It is like Array of objects.
- "System.Collections" is the Namespace for Arraylist. It automatically added to namespace section in aspx.cs page.
- We need not to specify object type arraylist going to contain.
- In arraylist each item is stored as object. And return value as object.
- It needs to box and unbox the elements.
List<T>:
- "System.Collections.Generic" is the Namespace for List. We need to add this.
- We need to specify object type which type of elements it contain.
- Ex: List<string> StrObj=new List<string>();
- From the above example StrObj will only store string objects.
- It doesn't need.