static void Main(string[] args) { AsyncBreakfast ab = new AsyncBreakfast(); //ab.BreakFastSynchronous(); Console.Read(); }
public void prepareAsyncBreakfast() { Console.WriteLine("\n Breakfast is going to be prepared asynchronously ...."); AsyncBreakfast breakfast = new AsyncBreakfast(); Task <Coffee> c = breakfast.prepareCoffee(); Task <Bacon> b = breakfast.prepareBacon(); Task <Juice> j = breakfast.prepareJuice(); Task <Toast> t = breakfast.prepareToast(); Console.WriteLine("\n Prepare the table while the breakfast ie getting ready ..."); c.Wait(); b.Wait(); j.Wait(); t.Wait(); }