C# doesn't allow locking on a null value. I suppose I could check whether the value is null or not before I lock it, but because I haven't locked it another thread could come along and make the value null! How can I avoid this race condition?
question from:https://stackoverflow.com/questions/7226231/why-doesnt-c-sharp-allow-a-null-value-to-be-locked