Skip to content

Instantly share code, notes, and snippets.

@KWMalik
Forked from yesez/gist:3214190
Created July 31, 2012 06:56
Show Gist options
  • Save KWMalik/3214387 to your computer and use it in GitHub Desktop.
Save KWMalik/3214387 to your computer and use it in GitHub Desktop.
Singleton
Public NotInheritable Class Singleton
Private Shared _Instance As Singleton = Nothing
Private Shared ReadOnly _Sync As New Object
Private Sub New()
End Sub
Public Shared ReadOnly Property Instance() As Singleton
Get
If _Instance Is Nothing Then
SyncLock _Sync
If _Instance Is Nothing Then
_Instance = New Singleton()
End If
End SyncLock
End If
Return _Instance
End Get
End Property
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment