Shared/Static Variable Should Be Nothing but Isn't - what gives?
- by Denis
I have the following code:
Public Class TestClass
Public Sub Test()
If theGlobal IsNot Nothing Then Throw New Exception("What gives!")
End Sub
Private Shared theGlobal As Object = Nothing
Private Shared ReadOnly Property Global
Get
If theGlobal Is Nothing Then
theGlobal = New Object()
End If
Return theGlobal
End Get
End Property
End Class
Am stumped... Why is theGlobal object NOT Nothing?