private void ResetFlagAndTakeLock(object lockObject, ref bool thisLockTaken) { Debug.Assert(lockObject != null, "'lockObject' MUST NOT be NULL."); thisLockTaken = false; Monitor.Enter(lockObject, ref thisLockTaken); }