Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
namespace SingletonExamples
{
/// <summary>
/// Broken, non thread-save solution.
/// Don't use this code.
/// </summary>
public class SingletonFirst
{
private static SingletonFirst _instance;
private SingletonFirst() { }
public static SingletonFirst Instance
{
get
{
if (_instance == null)
{
_instance = new SingletonFirst();
}
return _instance;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment