The explicit use of the method Monitor.Enter(object)
is discouraged. Moreover, the correct implementation of a fail-safe monitor-lock is cumbersome and requires unnecessary boilerplate code.
Use the provided lock
statement instead. This statement ensures correct acquisition and release of the lock.