C# System.Timers Demo
作者:互联网
static void Main(string[] args) { SystemTimersDemo(); Console.ReadLine(); } static void SystemTimersDemo() { System.Timers.Timer timer = new System.Timers.Timer(1000); timer.Elapsed += Timer_Elapsed; timer.AutoReset = true; timer.Enabled = true; } private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Console.WriteLine($"The Elapsed event was raised at {e.SignalTime.ToString("yyyyMMddHHmmssffff")}"); }
标签:C#,Demo,System,Timer,Elapsed,Timers,timer,static 来源: https://www.cnblogs.com/Fred1987/p/11770341.html