static public GetTime GetInstance() { if (_instance == null) { lock (key) { if (_instance == null) { _instance = new GetTime(); } } } return(_instance); }
static void Main(string[] args) { GetTime g1 = GetTime.GetInstance(); GetTime g2 = GetTime.GetInstance(); if (g1 == g2) { Console.WriteLine("Same"); } else { Console.WriteLine("Not Same"); } g1.PrintTime(); }