示例#1
0
 public static SingleTon GetInstance()
 {
     if (instance == null)
     {
         instance = new SingleTon();
     }
     return(instance);
 }
示例#2
0
        public static void Test()
        {
            Console.WriteLine("SingleTon:");
            var s = SingleTon.GetInstance();

            s.Data = "data";
            Console.WriteLine(s.Data);

            var p = SingleTon.GetInstance();

            Console.WriteLine(p.Data);
            SingleTon.ResetInstance();

            var q = SingleTon.GetInstance();

            Console.WriteLine(q.Data);
            Console.WriteLine("End SingleTon");
        }
示例#3
0
 public static void ResetInstance()
 {
     instance = null;
 }