Tuesday, December 30, 2008

Hashtable vs Dictionary<>

Hashtable, array, and ArrayList ---- System.Collections, weak data type
Dictionary<>, List<> -----System.Collection.Generic, strong data type

for example:
you can define hashtable:


Hashtable employees = new Hashtable();
employees.Add("A100",1);
employees.Add("A101",2);
employees.Add(3, "asdfasf");

no compile error

Dictinary diEmp = new Dictionary();

No comments: