Use of Timer in Windows Service
问题 I have a windows service where in I want to create a file every 10 seconds. I got many reviews that Timer in Windows service would be the best option. How can I achieve this? 回答1: Firstly, pick the right kind of timer. You want either System.Timers.Timer or System.Threading.Timer - don't use one associated with a UI framework (e.g. System.Windows.Forms.Timer or DispatcherTimer ). Timers are generally simple set the tick interval Add a handler to the Elapsed event (or pass it a callback on