Last active
July 13, 2018 23:40
-
-
Save DavidBrower/4e22f90c19c74955307f9fb915ced0d3 to your computer and use it in GitHub Desktop.
Lazy Singleton
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
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