Back to Browse

Difference between hashtable and dictionary in c# | Dictionary VS Hashtable c#

6.6K views
Apr 26, 2021
7:35

Difference between hashtable and dictionary in c# | Dictionary VS Hashtable c# | CSharp-Collections-Hashtable | c# interview questions and answers | .net interview questions and answers | c# interview questions Dictionary 1. Dictionary is a generic type 2. Dictionary class is a strong type Hence, you must specify the data types for key and value. 3. There is no need for boxing/unboxing. 4. When you try to access a non-existing key dictionary, it gives a runtime error. 5. Dictionary maintains an order of the stored values. There is no need for boxing/unboxing, so it is faster than Hashtable. Hashtable 1. Hashtable is a non-generic type. 2. Hashtable is a weakly typed data structure, so you can add keys and values of any object type. 3. Values need to have boxing/unboxing. 4. When you try to access the non-existing key Hashtable, it gives null values. 5. Hashtable never maintains an order of the stored values. Hashtable needs boxing/unboxing, so it is slower than Dictionary. #AllCpl #Hashtable #Dictionary #c-sharp #CSharp Dictionary Class #C# #CSharp-Collections-Hashtable

Download

0 formats

No download links available.

Difference between hashtable and dictionary in c# | Dictionary VS Hashtable c# | NatokHD