using System.Collections.Concurrent;
private static ConcurrentDictionary<string, int> cErrorsPerThread = new ConcurrentDictionary<string, int>();
public static void Main()
for (int i = 0; i < 5; i++)
private static void Send()
cErrorsPerThread.TryGetValue("THREAD1", out nCount);
cErrorsPerThread.AddOrUpdate("THREAD1", nCount++, (key, oldValue) => nCount++);
Console.WriteLine(cErrorsPerThread["THREAD1"]);