public void Add(int value) { _total += value; if (_total < _threshold) { return; } ThresholdReachedEventArgs args = new ThresholdReachedEventArgs { Threshold = _total, ReachedTime = DateTime.Now }; OnThresholdReached(args); }
private void OnThresholdReached(ThresholdReachedEventArgs args) { ThresholdReached?.Invoke(this, args); }
private static void OnThresholdReached(object sender, ThresholdReachedEventArgs e) { Console.WriteLine($"The threshold of {e.Threshold} was reached at {e.ReachedTime}"); _thresholdNotReached = false; }