内容目录
						
						Besides manually implementing the singleton pattern, you can also use the Lazy generic type to implement the singleton pattern.
    public sealed class Singleton
    {
        private static readonly Lazy<Singleton> lazy = new Lazy<Singleton>(() => new Singleton());
        public static Singleton Instance { get { return lazy.Value; } }
        private Singleton()
        {
        }
    }
                        
		
文章评论