static void Main(string[] args) { var boider = ChocolateBoiler.Instance(); boider.Fill(); boider.Boil(); boider = ChocolateBoiler.Instance(); boider.Empty(); }
public static ChocolateBoiler Instance() { if (_instance == null) { lock (_lock) { Console.WriteLine("Создаем экземпляр"); _instance = new ChocolateBoiler(); } } return(_instance); }