static void Main(string[] args) { if (SingleTon.GetSingleTon() == SingleTon.GetSingleTon()) { System.Console.WriteLine("Same instance"); } }
public static SingleTon GetSingleTon() { if (instance == null) { lock (syncLock) { if (instance == null) { instance = new SingleTon(); } } } return(instance); }