
简单的事件
- class Program
 -     {
 -         static void Main(string[] args)
 -         {
 -             Timer timer = new Timer{};
 -             timer.Interval = 1000;
 -             //时间对象的间隔属性,单位为毫秒
 -             Boy boy = new Boy();
 -             timer.Elapsed += boy.Action;
 -             //时间索引方法
 -             timer.Start();
 -             //开始计时
 -             Console.ReadLine();
 -         }
 -     }
 -  
 -     class Boy
 -     {
 -         //这些参数还没搞懂是干啥的,咋传进来使用的
 -         internal void Action(object sender, ElapsedEventArgs e)
 -         {
 -             Console.WriteLine("jump!");
 -             //每隔一秒输出一个jump!
 -         }
 -     }
 
 
事件的完整声明

听不懂,指路:刘铁锰c#编程

                

















