1.Dictionary is a generic type whereas Hashtable is not.
Dictionary is a generic type means
a)We get type safety with dictionary ,bcoz we can't insert any random object into it and don't have to cast the value when take out whereas in hashtable we can dynamically add or remove elements without indexing.
b)Generic collection is faster as there is no boxing or unboxing here.
c)Hashtable have to box/unbox so again there is memory consumption as well as performance penalties.
d)Hash table uses object to hold the things internally(only non generic way to do it).
2.Hashtable is a collection of name/value pairs that are organised on the basis of hash code of the key being specified. whereas In Dictionary we need to specify the types of both the key and the corresponding value.the value represents the actual object stored and the key represents a means to identify a particular object.
3 Hashtable is thread safe for use by multiple reader threads and a single writing thread whereas in Dictionary public static members are type safe but any instance members are not type safe.
4.We cannot use Dictionary with Web Services The reason is no web service standard supports generic standard.
sarika jainPosted Mar 1, 2011, 2:24 AM

