using system;
using system.threading;
class app {
public static void main() {
console.writeline("checking for status updates every 2 seconds.");
console.writeline(" (hit enter to termiante the sample)");
timer timer = new timer(new timercallback(checkstatus), null, 0, 2000);
console.write("press enter to close window…");
console.read();
}
// the callback methods signature must match that of a system.threading.timercallback
// delegate (it takes an object parameter and returns void)
static void checkstatus(object state) {
console.writeline("checking status.");
// …
}
}
