Skip to content

Instantly share code, notes, and snippets.

@tugberkugurlu
Created November 9, 2014 14:25
Show Gist options
  • Save tugberkugurlu/ccec05a3796ae9fb643f to your computer and use it in GitHub Desktop.
Save tugberkugurlu/ccec05a3796ae9fb643f to your computer and use it in GitHub Desktop.
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