// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; namespace Singleton { public class LazySingleton { private static readonly Lazy lazy_instance = new Lazy(() => new LazySingleton()); private int someState; private LazySingleton() { someState = 123; } public static LazySingleton Instance { get { return lazy_instance.Value; } } public void SomeMethod() { Console.WriteLine(someState); } } }