Пример #1
0
        /// <summary>
        /// 符合c#语言规范写法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void ShowMsg(Object sender, Heater.BoiledEventArgs e)
        {
            Heater heater = (Heater)sender;

            Console.WriteLine("Display:{0}-{1}:", heater.area, heater.type);
            Console.WriteLine("Display:水烧开了,当前温度:{0}度", e.temperature);
        }
Пример #2
0
        /// <summary>
        /// 符合c#语言规范得写法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void MakeAlert(Object sender, Heater.BoiledEventArgs e)
        {
            Heater heater = (Heater)sender;//这里是不是很熟悉

            Console.WriteLine("Alarm:{0}-{1}:", heater.area, heater.type);
            Console.WriteLine("Alarm:嘀嘀嘀,水已经{0}度了:", e.temperature);
            Console.WriteLine();
        }