Skip to main content

One post tagged with "multi-threading"

View All Tags

· 3 min read

Well that's an interesting title but what does it mean? I assume you know about the .NET [System.Collections.Concurrent][1] namespace. It provides several thread-safe collection classes, one of which is [ConcurrentDictionary<TKey, TValue>][2]. The standard Dictionary class is not thread-safe and when a reader detects a simultaneous write it throws an InvalidOperation: Collection was modified; enumeration operation may not execute. A ConcurrentDictionary can be read from and written to simultaneously from multiple threads.