public static SingleTon GetInstance() { if (instance == null) { instance = new SingleTon(); } return(instance); }
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"); }
public static void ResetInstance() { instance = null; }