public void SetTemperature(int temperature) { if (temperature >= this.HighTemperature) { FireHandler?.Invoke(this, new FireEventArgs() { CurrentTemperature = temperature, HighestTemperature = this.HighTemperature } );// can only invoke in current class } else { Console.WriteLine("normal temperature"); } }
protected void EventInvoke(FireEventArgs fireEventArgs) { // can only invoke in current class,(FireHandler in abstractPerform) // so build this method to be used by derived class FireHandler?.Invoke(this, fireEventArgs); }