April 2008
Intermediate to advanced
704 pages
17h 49m
English
Problem
You need to execute a method in a separate thread at a specific time.
Solution
Declare a method containing the code you want to execute. The method's signature must match that defined by the System.Threading.TimerCallback delegate; that is, it must be a subroutine (not a function) and take a single Object argument. Create a System.Threading.Timer object, and pass it the method you want to execute along with a state Object that the timer will pass to your method when the timer expires. Calculate the time difference between the current time and the desired execution time, and configure the Timer object to fire once after this period of time.
How It Works
Executing a method at a particular time is ...
Read now
Unlock full access