Tuesday, October 19, 2021

4 Take-aways for .NET Dictionary

Background: .NET has four built-in dictionary/map types.

Here are some take aways. 

  1. Hashtable - Avoid use hashtable because it is weakly typed.
  2. Dictionary<T> - Hashtable strongly typed replacement. Not thread safe
  3. ConcurrentDictionary<T> - Good read speed even in the face of concurrency, but it’s a heavyweight object to create and slower to update.
  4. ImmutableDictionary<T> - No locking required to read but more allocations require to update than a dictionary.

No comments:

Thumbs Up to GitHub Copilot and JetBrains Resharper

Having used AI tool GitHub Copilot since 08/16/2023, I’ve realized that learning GitHub Copilot is like learning a new framework or library ...