protected virtual void OnNameReached(NameReachedEventArgs e) { EventHandler <NameReachedEventArgs> handler = NameReached; if (handler != null) { handler(this, e); } }
public void Add(int x) { total += x; if (total > threshold) { NameReachedEventArgs args1 = new NameReachedEventArgs(); args1.Name = "Diana"; args1.Surname = "Zheltok"; OnNameReached(args1); } if (total == threshold) { ThresholdReachedEventArgs args = new ThresholdReachedEventArgs(); args.Threshold = threshold; args.TimeReached = DateTime.Now; OnThresholdReached(args); } }
static void c_NameReached(object sender, NameReachedEventArgs e) { Console.WriteLine("I am {0} {1}.", e.Name, e.Surname); }