Created
September 28, 2017 09:45
-
-
Save NMZivkovic/1020b622ddaa44c68c2bb27d566cd8b5 to your computer and use it in GitHub Desktop.
This file contains 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
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