Saturday, May 12, 2012

Difference between Dictionary and Hashtable

Dictionary
System.Collections.Generic.Dictionary<object,object>

Dictionary<TKey,TValue> is a generic type, allowing:
 
  • static typing (and compile-time verification)
  • use without boxing
If you are .NET 2.0 or above, you should prefer Dictionary<TKey,TValue> (and the other generic collections)

Hashtable
System.Collections.Hashtable

Hashtable is of collection type.
A subtle but important difference is that Hashtable supports multiple reader threads with a single writer thread, while Dictionary offers no thread safety.
If you need thread safety with a generic dictionary, you must implement your own synchronization or (in .NET 4.0) use ConcurrentDictionary<TKey, TValue>.

Best of Luck.

2 comments:

  1. Difference Between Dictionary And Hashtable >>>>> Download Now

    >>>>> Download Full

    Difference Between Dictionary And Hashtable >>>>> Download LINK

    >>>>> Download Now

    Difference Between Dictionary And Hashtable >>>>> Download Full

    >>>>> Download LINK pw

    ReplyDelete