public static class Program
public static void Main()
Item item = new Item(1,"Product1",254,10);
Console.WriteLine("Enter the Stock in hand value");
int val = Convert.ToInt32((Console.ReadLine()));
item.Stock_in_hand = val;
Console.WriteLine(item.Stock_in_hand.ToString());
int itemid; string name;int price; int stockinhand;
order.RefillRequest += new EventHandler(RefillRequestHandler);
order.InitiateRefillRequest();
public Item(int id,string name,int price,int stockinhand)
this.order = new Order();
this.Stock_in_hand = stockinhand;
public void RefillRequestHandler(object sender, EventArgs e)
Console.WriteLine("Event triggered!!");
public delegate void EventHandler(object sender, EventArgs e);
public event EventHandler RefillRequest;
public void InitiateRefillRequest()
protected virtual void OnStockInHandReduced()
if(RefillRequest != null)
RefillRequest.Invoke(this,null);
public void RefillRequestHandler(object sender, EventArgs e)
Console.WriteLine("Event triggered and code executed");