Background: .NET has four built-in dictionary/map types.
Here are some take aways.
- Hashtable - Avoid use hashtable because it is weakly typed.
- Dictionary<T> - Hashtable strongly typed replacement. Not thread safe
- ConcurrentDictionary<T> - Good read speed even in the face of concurrency, but it’s a heavyweight object to create and slower to update.
- ImmutableDictionary<T> - No locking required to read but more allocations require to update than a dictionary.
No comments:
Post a Comment