Esempio n. 1
0
        static void Main(string[] args)
        {
            var boider = ChocolateBoiler.Instance();

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

            boider = ChocolateBoiler.Instance();

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

            return(_instance);
        }