public void Add(int value) { total += value; if (total >= THRESHOLD) { // var args = new ThresholdReachedEventArgs(); args.Threshold = THRESHOLD; args.TimeReached = DateTime.Now; ThresholdReached?.Invoke(this, args); } }
static void c_ThresholdReached(object sender, ThresholdReachedEventArgs e) { Console.WriteLine("The threshold was reached"); Console.WriteLine($"Threshold: {e.Threshold}"); Console.WriteLine($"TimeReached: {e.TimeReached}"); }