Beispiel #1
0
 public void Add(int x)
 {
     total += x;
     if (total >= threshold)
     {
         var args = new ThresholdReachedEventArgs
         {
             Threshold   = threshold,
             TimeReached = DateTime.Now
         };
         OnThresholdReached(args);
     }
 }
Beispiel #2
0
 static void C_ThresholdReached(object sender, ThresholdReachedEventArgs e)
 {
     Console.WriteLine($"The threshold of {e.Threshold} was reached at {e.TimeReached}.");
     Console.ReadLine();
     Environment.Exit(0);
 }