https://blog.csdn.net/qq_38992403/article/details/105137401
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace Timer_
{
class Program
{
static void Main(string[] args)
{
Timer timer = new Timer();
timer.AutoReset = true;
timer.Interval = 1000;
timer.Elapsed += new ElapsedEventHandler(Tick);
timer.Start();
Console.Read();
}
public static void Tick( object sender,System.Timers.ElapsedEventArgs e)
{
Console.WriteLine("每秒执行一次");
}
}
}
网友评论