Tuesday, May 5, 2009

Singleton class

 Public Class MySingletonCls

Private Shared objSingle As MySingletonCls
Private Shared bIsCreated As Boolean

Private Sub New()
'Override the default constructor
End Sub

Public Shared Function CreateInstance() As
MySingletonCls
If bIsCreated = False Then
objSingle = New
MySingletonCls()
bIsCreated = True
Return objSingle
Else
Return objSingle
End If
End Function
End Class

No comments: