Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NETADO.NET
What is HashTable ? and what is the use of HashTable?
Posted 21-Oct-12 15:42pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hashtable optimizes lookups. It computes a hash of each key you add. It then uses this hash code to look up the element very quickly
 
you can check the detailed article here
http://www.dotnetobject.com/Thread-How-Hashtable-works-in-c[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 450
1 Sergey Alexandrovich Kryukov 350
2 Shai Vashdi 318
3 OriginalGriff 265
4 Peter Leow 171
0 Sergey Alexandrovich Kryukov 9,109
1 OriginalGriff 5,290
2 Peter Leow 4,010
3 Maciej Los 3,535
4 Abhinav S 3,263


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid