How to have a loop in a Windows service without using the Timer

前端 未结 5 890
清歌不尽
清歌不尽 2020-11-29 01:29

I want to call a Business layer method from a Windows service (done using C# and .NET) after every 10 seconds. However, i dont want to use the Timer_Elapsed event since it s

5条回答
  •  温柔的废话
    2020-11-29 02:15

    Use a timer, but as soon as you enter the Timer handler method, disable the timer so that no more events are raised. Just before exiting the handler, re-enable the timer.

提交回复
热议问题