'
' This class implements the Singleton pattern
'
Public Class Singleton
' Constructor is private so we can not create it
' Must use getInstance that return one (1) instance of the object.
Private Sub New()
End Sub
Private Shared m_oInstance As Singleton
Public Shared Function getInstance() As Singleton
SyncLock GetType(Singleton)
If IsNothing(m_oInstance) Then
m_oInstance = New Singleton
End If
End SyncLock
Return m_oInstance
End Function
End Class
|