Dictionary is a generic collection. So it can store key-value pairs of specific data types. Hashtable is thread safe. Only public static members are thread safe in Dictionary.
Hashtable returns null if we try to find a key which does not exist. Dictionary throws an exception if we try to find a key which does not exist. Data retrieval is slower than dictionary because of boxing-unboxing. Data retrieval is faster than Hashtable. Related Articles. How to sort the generic SortedList in the descending order?
Add '' , 'Employee2' ; hash. Add '' , 'Employee3' ; hash. Add 'A' , 'Employee4' ; if hash. Add '' , 'Employee5' ; Console. Array list only store value. Array list have numeric index.
Hashtable can have string index. In hashtable we can store different type of data int , string etc. You can vist these useful related post. Manish Kumar. Post Reset. Retrieving by key in Hashtable is faster than retrieving in Arraylist 0.
Aug, 1. Array list is a list where we can add items Hash table is a map, key value pairs 0. Developer Programmer Sr. Developer Sr. Why do you want to leave your current company? What is ASP. NET Core? How to iterate through ArrayList in jQuery? What is the difference between TempData keep and peek function?
0コメント