示例#1
0
        public static void Main(string[] args)
        {
            EagerSingleton eagerSingleton = EagerSingleton.GetInstance();

            Console.WriteLine(eagerSingleton.ToString());

            LazySingleton lazySingleton = LazySingleton.GetInstance();

            Console.WriteLine(lazySingleton.ToString());
        }
示例#2
0
        private static void TestSingleton(string value)
        {
            var singleton = LazySingleton.GetInstance(value);

            Console.WriteLine(singleton.Value);
        }