private string ProcessFile(string fileContent) { int incremented = Interlocked.Increment(ref _processingCount); NumberOfProcessingTasks.Add(incremented); string result = fileContent.ToUpper(); Thread.Sleep(250); // simulate hard work Interlocked.Decrement(ref _processingCount); return(result); }