This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClassToLock { } | |
volatile ClassToLock? _classToLock; | |
readonly object _classLock = new(); | |
public ClassToLock myClass | |
{ | |
get | |
{ | |
if (_classToLock == null) // First check (outside lock) | |
lock (_classLock) |