.NET, event every minute (on the minute). Is a timer the best option?

后端 未结 14 2202
-上瘾入骨i
-上瘾入骨i 2020-11-27 03:02

I want to do stuff every minute on the minute (by the clock) in a windows forms app using c#. I\'m just wondering whats the best way to go about it ?

I could use a t

14条回答
  •  醉梦人生
    2020-11-27 03:50

    How about:

    int startin = 60 - DateTime.Now.Second;
    var t = new System.Threading.Timer(o => Console.WriteLine("Hello"), 
         null, startin * 1000, 60000);
    

提交回复
热议问题