DEV415
You are in a dark room with no signs of life. You still have your torch and $356. You can go North (N) or South (S). Your choice? _
async void ServeCustomer(Customer customer) { var order = TakeOrder(customer); try { var pizza = await GetSomeoneToMakeThePizza(order); GivePizzaToCustomer(customer, pizza); using (var employee = GetNewEmployee()) { await WaitForCustomerToFinishEating(); employee.CleanUpCustomerRubbish(); } catch (PizzaMakingException ex) { }
Head to... aka.ms/te
void CallYield() { int callIndex = 0; Console.WriteLine(“ Call - 1"); foreach (var number in GetNumbers()) { Console.WriteLine(" Call: " + callIndex++); } IEnumerable GetNumbers() { Console.WriteLine("Before 1"); yield return 1; Console.WriteLine("Before 2"); yield return 2; Console.WriteLine("Yield finished"); } Call - 1 Before 1 Call: 0 Before 2 Call: 1 Yield finished Call: 2