Sunday, January 22, 2012
Hashtable v. Dictionary
The Dictionary(Of TKey, TValue) and ConcurrentDictionary(Of TKey, TValue)classes have the same functionality as the Hashtable class. A Dictionary(Of TKey, TValue) of a specific type (other than Object) provides better performance than a Hashtable for value types. This is because the elements of Hashtable are of type Object; therefore, boxing and unboxing typically occur when you store or retrieve a value type. The ConcurrentDictionary(Of TKey, TValue)class should be used when multiple threads might be accessing the collection simultaneously.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment