示例#1
0
        static void Main(string[] args)
        {
            var boider = ChocolateBoiler.Instance();

            boider.Fill();
            boider.Boil();

            boider = ChocolateBoiler.Instance();

            boider.Empty();
        }
示例#2
0
        public static ChocolateBoiler Instance()
        {
            if (_instance == null)
            {
                lock (_lock)
                {
                    Console.WriteLine("Создаем экземпляр");
                    _instance = new ChocolateBoiler();
                }
            }

            return(_instance);
        }