public void Add(int x) { total += x; if (total >= threshold) { var args = new ThresholdReachedEventArgs { Threshold = threshold, TimeReached = DateTime.Now }; OnThresholdReached(args); } }
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); }