Is there simple way to SyncLock an object that can be null?
And before you ask for it, yes, I know that it isn't logical to perform a SyncLock on a null variable. However, that would simplify my code because right now, I have no choice but to perform a null check all over the place before calling a SyncLock.
If myObjectA Is Nothing Then
myObjectA = myObjectB
Else
SyncLock myObjectA
myObjectA = myObjectB
End SyncLock
End If