码迷,mamicode.com
首页 > Windows程序 > 详细

C# System.Timers Demo

时间:2019-10-31 11:55:45      阅读:104      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!