static SmartServiceCreator() { if (instance == null) { lock (dimmy) { if (instance == null) { instance = new SmartServiceFactory(); } } } }
static void Main(string[] args) { ISmartServiceFactory factory1 = SmartServiceCreator.Instance; ISmartServiceFactory factory2 = SmartServiceCreator.Instance; if (factory1 == factory2) { Console.WriteLine("Is one!"); } else { Console.WriteLine("Ooops!"); } }