Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created September 28, 2017 09:51
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 NMZivkovic/65562ef8f4daaf0668ab19d6140f2dc1 to your computer and use it in GitHub Desktop.
Save NMZivkovic/65562ef8f4daaf0668ab19d6140f2dc1 to your computer and use it in GitHub Desktop.
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