예제 #1
0
        static void Main(string[] args)
        {
            BurgerMaster burgerMaster = new BurgerMaster();

            var stopwatch = new System.Diagnostics.Stopwatch();

            stopwatch.Start();

            Task <Patty> pattyTask   = burgerMaster.CookPattyAsync();
            var          friesTask   = burgerMaster.FryFriesAsync();
            var          produceTask = burgerMaster.ChopProduceAsync();
            var          bunTask     = burgerMaster.ToastBunAsync();

            // Cook patty
            Patty patty = pattyTask.Result;

            // Fry some fries
            Fries fries = friesTask.Result;

            // Chop some veggies
            Produce produce = produceTask.Result;

            // Toasted bun
            Bun bun = bunTask.Result;

            // Assemble burger
            Burger burger = burgerMaster.AssembleBurger();

            stopwatch.Stop();
            Console.WriteLine(stopwatch.ElapsedMilliseconds);
            Console.ReadKey();
        }
예제 #2
0
        public void Run()
        {
            BurgerMaster burgerMaster = new BurgerMaster();

            Patty patty = burgerMaster.CookPatty();

            Console.WriteLine("Patty Done");
            Fries fries = burgerMaster.FryFries();

            Console.WriteLine("Fries Done");
            Bun bun = burgerMaster.ToastBun();

            Console.WriteLine("Bun Toasted");
            Produce produce = burgerMaster.ChopProduce();

            Console.WriteLine("Produce Chopped");

            burgerMaster.AssembleBurger();
            Console.WriteLine("Enjoy Burger");

            Console.ReadKey();
        }