The uses of
Hashtable
is related to the fact that it supports lookup of an element of collection by some key with the
computational complexity of O(1); that is, the time of search asymptotically does not grow with growing the size of the collection but remains approximately the same on average, with big collections.
Please see:
http://en.wikipedia.org/wiki/Big_O_notation[
^],
http://en.wikipedia.org/wiki/Computational_complexity_theory[
^].
Also, the type support uniqueness of the key in the scope of collection.
The problem with this type in .NET is that its is the obsolete because it is
not generic, which required potentially error-prone type casts.
There is no reason to ever use it in any new development, because generics were introduced in .NET Framework v.2.0, and using earlier .NET version hardly makes any sense. This type was not formally marked with
[Obsolete]
attribute just because there is nothing wrong with keeping it in existing and well working legacy code.
In any new development, you should to use any of the three generic types instead of
HashTable
:
http://msdn.microsoft.com/en-us/library/xfhwa508.aspx[
^],
http://msdn.microsoft.com/en-us/library/f7fta44c.aspx[
^],
http://msdn.microsoft.com/en-us/library/ms132319.aspx[
^].
These classes are different majorly by different trade-off between performance and redundancy.
—SA