Skip to content

Instantly share code, notes, and snippets.

@wjkhappy14
Created July 26, 2018 03:48
Show Gist options
  • Save wjkhappy14/b227f7fda93cfadd69d10cb1b9acaa30 to your computer and use it in GitHub Desktop.
Save wjkhappy14/b227f7fda93cfadd69d10cb1b9acaa30 to your computer and use it in GitHub Desktop.
Lazy Singleton
public sealed class Singleton
{
private static readonly Lazy<Singleton> lazy =
new Lazy<Singleton>(() => new Singleton());
public static Singleton Instance { get { return lazy.Value; } }
private Singleton()
{
}
}
http://csharpindepth.com/Articles/General/Singleton.aspx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment