private static int GetNextCounterValue() { #if COREFX lock(counterLock) { return counter++; } #else return Interlocked.Increment(ref counter); #endif }