How to stop all running timer
How to stop all timer in c# ?
Timer timer = new Timer();
timer.stop();
this code didn't work , I have 5 timer and i'm lazy to write timer1.stop timer2.stop and more ...
How can i stop all timer ?
Answers:
During the creation of your timers, do something like this
var Timerlist = new List<Timer>();
Timer timer1 = new Timer();
Timerlist.Add(timer1);
....
foreach(var timer in Timerlist)
{
timer.Start();
}
....
foreach(var timer in Timerlist)
{
timer.Stop();
}