Dictionary
- 1. Request to access for non-existing key will throw an exception.
- 2. Dictionary is a Generic Type.
- 3. Generic Collections are a lot faster for value types as there is no boxing and Unboxing.
- 4. Dictionary Public static members are thread safe, but any instance members are not guaranteed to be thread safe.
- 5. Dictionary is preferred over Hash Table.
Hash Table
- 1. Request to access for non-existing key gives null instead of error.
- 2. Hash Table is Non-Generic Type.
- 3. Hash Table also have to Box/Unbox, which may have memory consumption as well as performance penalties.
- 4. Hash Table is a thread safe for use by multiple reader threads and a single writing thread.
No comments:
Post a Comment