Created
November 9, 2014 14:25
-
-
Save tugberkugurlu/ccec05a3796ae9fb643f to your computer and use it in GitHub Desktop.
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
pulic class Singleton | |
{ | |
private static readonly object _mutex = new object(); | |
private static Singleton _instance; | |
private Singleton() | |
{ | |
} | |
public static Singleton Instance | |
{ | |
get | |
{ | |
if(_instance == null) | |
{ | |
lock(_mutex) | |
{ | |
if(_instance == null) | |
{ | |
_instance = new Singleton(); | |
} | |
} | |
} | |
return _instance; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment