static void Main(string[] args) { //var del1= new WorkPerformedHandler(WorkPerformed1); //var del2= new WorkPerformedHandler(WorkPerformed2); //var del3= new WorkPerformedHandler(WorkPerformed3); //del1(5, WorkType.Golf); //del2(10, WorkType.GotToMettings); /* inovkation list of multicast del1 += del2; del1 += del3; */ /* shortcut for invokation list multicast del1 += del2 + del3; */ //del1(10, WorkType.Golf); //DoWork(del2); var worker = new Worker(); //worker.WorkPerformed += Worker_WorkPerformed; //worker.WorkCompleted += Worker_WorkCompleted; //same as the above using lambda expression worker.WorkPerformed += (s,e)=>Console.WriteLine("Hours"+ e.Hours +"WorkType "+e.WorkType); worker.WorkCompleted += (s,e)=>Console.WriteLine("Work completed"); worker.DoWork(10,WorkType.GeneratingReports); Console.Read(); }
static void Main() { // ReSharper disable once AssignmentIsFullyDiscarded _ = new Worker(); }