79673832

Date: 2025-06-20 18:53:25
Score: 4
Natty:
Report link

Is there anything wrong with the following as a short solution?

private object myLock = new object();

if (Monitor.TryEnter(myLock))
{
    doWork();
    Monitor.Exit(myLock);
}
else
{
    lock (myLock){ };
}
Reasons:
  • Blacklisted phrase (1): Is there any
  • Low length (0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): Is there any
  • Low reputation (0.5):
Posted by: Ace