The Timer
following is System.Windows.Forms.Timer
C# Code:
Timer myTimer = new Timer();
myTimer.Interval = 10000;
myTimer.Tick += new EventHandler(doSth);
myTimer.Start();
The timer will doSth
every 10 seconds, but how to let it doSth
immediately when starting?
I tried to create a custom timer which extends Timer
, but I can't override the Start
method.
For now, my code is:
myTimer.Start();
doSth(this, null);
I don't think it's good. How to improve it?