using System.Collections.Generic;
using System.Threading.Tasks;
public static void Main(string[] args)
reserveCustomer rCust = new reserveCustomer();
rCust.allocateCustomerToTable += MyTable;
mealChange mChange = new mealChange();
mChange.serveCustomerMeal += MyCustomer;
Queue<Customer> cust = new Queue<Customer>();
cust.Enqueue(new Customer() { FirstName = "Vasuki", LastName = "Kana" });
cust.Enqueue(new Customer() { FirstName = "San", LastName = "Jeev" });
cust.Enqueue(new Customer() { FirstName = "Bhish", LastName = "Man" });
cust.Enqueue(new Customer() { FirstName = "San", LastName = "Bhish" });
cust.Enqueue(new Customer() { FirstName = "Vas", LastName = "San" });
foreach (var cus in cust)
rCust.createNotification();
Console.WriteLine("---------------");
Console.WriteLine("{0} {1} got a table", cus.FirstName, cus.LastName);
mChange.createNotificationforMeal();
Console.WriteLine("Everyone is full!");
public static void MyTable(object sender, table e)
Console.WriteLine(e.tablestatus);
public static void MyCustomer(object sender, Customer e)
foreach (var values in Enum.GetValues(typeof(Customer.meal)))
Console.WriteLine("{0} {1} is having {2}.", e.FirstName, e.LastName, values);
public class reserveCustomer
public event tableOpen allocateCustomerToTable;
public void createNotification()
if (allocateCustomerToTable != null)
table tableinfo = new table();
tableinfo.tablestatus = "Table is Open";
allocateCustomerToTable(this, tableinfo);
public delegate void tableOpen(object sender, table e);
public class table : EventArgs
public string tablestatus { get; set; }
public delegate void CMealChange(object sender, Customer e);
public class Customer : EventArgs
public string FirstName { get; set; }
public string LastName { get; set; }
Appetizer, Main, Desert, Done
public meal Meals { get; set; }
public event CMealChange serveCustomerMeal;
public void createNotificationforMeal()
if (serveCustomerMeal != null)
serveCustomerMeal(this, new Customer());