private static void TestCounter(ICounter counter) { var safeCounterListener = new SafeCounterListener(); var actions = Enumerable.Range(0, 10).Select(index => (Action)(() => { for (int iteration = 0; iteration < 100; iteration++) { var nextCounter = counter.GetAndIncrement(); safeCounterListener.ReceiveCounter(nextCounter); } })).ToArray(); Parallel.Invoke(actions); }