filmov
tv
Dictionary VS Hashtable c#
Показать описание
Hashtable:
------------------------------------------------------------
Is included in the System.Collections namespace.
Is a loosely typed (non-generic) collection, this means it stores key-value pairs of any data types.
Is thread safe.
Hashtable returns null if we try to find a key which does not exist.
Data retrieval is slower than dictionary because of boxing-unboxing.
Dictionary:
------------------------------------------------------------
Is included in the System.Collections.Generic namespace.
Is a generic collection. So it can store key-value pairs of specific data types.
It throws an exception if we try to find a key which does not exist.
Data retrieval is faster than Hashtable.
------------------------------------------------------------
Is included in the System.Collections namespace.
Is a loosely typed (non-generic) collection, this means it stores key-value pairs of any data types.
Is thread safe.
Hashtable returns null if we try to find a key which does not exist.
Data retrieval is slower than dictionary because of boxing-unboxing.
Dictionary:
------------------------------------------------------------
Is included in the System.Collections.Generic namespace.
Is a generic collection. So it can store key-value pairs of specific data types.
It throws an exception if we try to find a key which does not exist.
Data retrieval is faster than Hashtable.