Array List
|
Hash Table
|
ArrayList is a List
|
Hash Table is a Map
|
ArrayList is just a wrapper of the class Array. Its internal representation is same as Array, just we use it to get few extra methods provided with it.
|
HashTable is same as arraylist, but with a small addition. It is actually an array of a Structure.
|
In Array List we can ADD only items to the List
|
In Hash Table we can ADD Data with Key
|
In Array List we can ADD any DataType value, Every item in ArrayList is treated as Object.
|
Retrieving by key in Hash Table is faster than retrieving in ArrayList
|
In one word, ArrayList is Index based.
|
Hash Table is on both Index based and KeyBased.
|
Ex
ArrayList arraylist = new ArrayList();
arraylist.Add("Myblog");
arraylist.Add(9);
|
Ex
Hashtable ht = new Hashtable();
ht.Add("IndexOne","IndexValue");
ht.Add("IndexTwo",20);
ht.Add("MyBlogName","ReddyInfoSoft");
|
Tuesday, February 12, 2013
Differences Between ArrayList and HashTable in C#
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment