您的位置:首页 > 其它

在Windows服务中如何使用计时器?

2016-06-22 22:50 344 查看

解决方案

System.Timers.Timer t =new System.Timers.Timer(200);//实例化Timer类,设置间隔时间为10000毫秒;
t.Elapsed  =new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
t.AutoReset =true;//设置是执行一次(false)还是一直执行(true);
t.Enabled =true;//是否执行System.Timers.Timer.Elapsed事件;


参考

http://www.cnblogs.com/virusswb/archive/2008/12/24/1361365.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  windows 解决方案