C# System.Timers Demo

2021-05-17 17:28

阅读:545

标签:object   tostring   dem   private   led   readline   set   span   oid   

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# System.Timers Demo

标签:object   tostring   dem   private   led   readline   set   span   oid   

原文地址:https://www.cnblogs.com/Fred1987/p/11770341.html


评论


亲,登录后才可以留言!