close
using System;
using System.Timers;
namespace TimerExample
{
class Program
{
static void Main(string[] args)
{
System.Timers.Timer timer = new System.Timers.Timer();
timer.Enabled = true;
timer.Interval = 600000; //执行间隔时间,单位为毫秒; 这里实际间隔为10分钟
timer.Start();
timer.Elapsed += new System.Timers.ElapsedEventHandler(test);
Console.ReadKey();
}
private static void test(object source, ElapsedEventArgs e)
{
Console.WriteLine("OK, test event is fired at: " + DateTime.Now.ToString());
}
}
}
http://www.cnblogs.com/wusir/p/3636149.html
全站熱搜
留言列表