Shared/Static Variable Should Be Nothing but Isn't - what gives?
Posted
by
Denis
on Stack Overflow
See other posts from Stack Overflow
or by Denis
Published on 2011-01-06T19:30:53Z
Indexed on
2011/01/06
19:53 UTC
Read the original article
Hit count: 190
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?
© Stack Overflow or respective owner