-
-
Save KWMalik/3214387 to your computer and use it in GitHub Desktop.
Singleton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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