Example #1
0
 /*
  * In the standard practise, the method name is the event name with a prefix 'On'.
  * For example, MyIntChanged(event name) is prefixed with 'On' here.
  * Also, in normal practises, instead of making the method 'public',
  * you make the method 'protected virtual'.
  */
 protected virtual void OnMyIntChanged()
 {
     if (MyIntChanged != null)
     {   //Combine your data with the event argument
         JobNoEventArgs jobNoEventArgs = new JobNoEventArgs();
         jobNoEventArgs.JobNo = myInt;
         MyIntChanged(this, jobNoEventArgs);
     }
 }
Example #2
0
 public void GetNotificationFromSender(Object sender, JobNoEventArgs e)
 {
     Console.WriteLine("Receiver receives a notification: Sender recently has changed the myInt value to {0}.", e.JobNo);
 }