[In addition to a correct answer by Mehdi, Solution 1:]
Also, you should understand that the class
System.Collections.Hashtable
was rendered obsolete as early as in .NET Framework, v.2.0, when generics were introduced. Instead, for all new development you should use the classes
System.Collections.Generic.Dictionary
,
System.Collections.Generic.SortedDictionary
or
System.Collections.Generic.SortedList
; please see:
http://msdn.microsoft.com/en-us/library/system.collections.generic.aspx[
^].
Each of these classes can replace
Hashtable
, the differences are mostly different trade-off between data redundancy and speed of search algorithms.
—SA