Difference Between ArrayList And GenericList
ArrayList | GenericList | |
1 |
ArrayList is not Type Safe.
using System.Collections; |
GenericList is Type Safe.
using System.Collections.Generic |
2 |
Can Store Anything in ArrayList like int, string and datetime.
|
Only Specfic Data Type like int, string and datetime.
|
3 |
ArrayList AList = new ArrayList();
AList.Add(012345);
AList.Add("DotNet");
AList.Add(DateTime.Now);
|
List<string> LString = new List<string>();
LString.Add("DotNet");
LString.Add(".Net");
LString.Add("Dot.Net")
|
4 |
ArrayList Stores All Data as Object thus Call Related DataType Correctly.
|
Generic List Stores All Data of the Data Type No Type Conversion Need.
|
5 |
int number = Convert.ToInt32(AList[0]);
DateTime DT = Convert.ToDateTime(AList[1]);
string Name = AList[2].ToString();
|
string name = LString[0];
string name = LString[1]; |
0 comments:
Post a Comment