using System;
using System.Threading;
class MyClock {
public static void showTime(Object stateInfo) {
Console.WriteLine("{0}", DateTime.Now.ToString("h:mm:ss:fff"));
}
}
class Client {
static void Main() {
Timer timer = new Timer(new TimerCallback(MyClock.showTime),
new AutoResetEvent(false), 0, 250);
while(true);
}
}
Reference : http://www.cnblogs.com/oomusou/archive/2007/07/28/834328.html
沒有留言:
張貼留言