Last active
August 29, 2015 14:06
-
-
Save Marfusios/b3309d095a90d214bea8 to your computer and use it in GitHub Desktop.
Thread safe and lazy initialized implementation of Singleton design pattern in C#.
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 class Class1 | |
{ | |
private Class1() { } | |
public static Class1 Instance | |
{ | |
get { return Class1Creator.instance; } | |
} | |
private class Class1Creator | |
{ | |
static Class1Creator() { } | |
internal static readonly Class1 instance = new Class1(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment