public void BoilWater() { for (int i = 0; i <= 100; i++) { temperature = i; if (temperature >= 95) { BoiledEventArgs e = new BoiledEventArgs(temperature, type); OnBoiled(e); } } }
protected virtual void OnBoiled(BoiledEventArgs e) { base.Notify(e); }
public static void Display(Object sender, BoiledEventArgs e) { Console.WriteLine("水开啦,当前温度:{0},型号:{1}", e.temperature, ((Heater)sender).type); }