This is again a typical collection .NET interview question. Dictionary is faster than hashtable as dictionary is a generic strong type. Hashtable is slower as it takes object as data type which leads to boxing and unboxing.
Below goes the same code for hashtable and dictionary.
Hashtable hashtable = new Hashtable();
hashtable = "Two";
hashtable = "Thirteen";
var dictionary = new Dictionary<string,
Asked In: Many Interviews |