Skip to content

Instantly share code, notes, and snippets.

@DavidBrower
Last active July 13, 2018 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidBrower/4e22f90c19c74955307f9fb915ced0d3 to your computer and use it in GitHub Desktop.
Save DavidBrower/4e22f90c19c74955307f9fb915ced0d3 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 {=> lazy.Value;
private Singleton() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment