ConcurrentMap<TKey, TValue>
Namespace: RisingV.Shared.Collections.Concurrent
A thin alias around ConcurrentDictionary<TKey,TValue>
that also implements IMap
.
Use it when you need lock‑free concurrent reads/writes but still want to expose
the same abstraction (IMap
) as other collections in the family.
IMap<Guid, Player> players = new ConcurrentMap<Guid, Player>();
// Multiple threads may add/remove safely
players[player.Id] = player;
Constructors
All the ConcurrentDictionary
constructor flavors are exposed:
ConcurrentMap()
ConcurrentMap(IEnumerable<KeyValuePair<TKey,TValue>> collection)
ConcurrentMap(IEqualityComparer<TKey> comparer)
ConcurrentMap(int concurrencyLevel, int capacity, …)
- …and so on
When to Choose
- High‑throughput multi‑threaded scenarios.
- Producer/consumer pipelines.
- Shared caches in ASP.NET or game servers.
For single‑threaded contexts prefer Map
; for capped caches prefer SizedDictionaryAsync
.