Created
September 28, 2017 09:51
-
-
Save NMZivkovic/65562ef8f4daaf0668ab19d6140f2dc1 to your computer and use it in GitHub Desktop.
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
using System; | |
namespace SingletonExamples | |
{ | |
/// <summary> | |
/// Solution using Lazy implementation. | |
/// </summary> | |
public class SingletonLazy | |
{ | |
private static readonly Lazy<SingletonLazy> instance = | |
new Lazy<SingletonLazy>(() => new SingletonLazy()); | |
public static SingletonLazy Instance { get { return instance.Value; } } | |
private SingletonLazy() | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment