C#: is there an equivalent class of TimerTask from Java in C#? [duplicate]
Possible Duplicate:
C#: is there an equivalent class of TimerTask from Java in C#?
Hi,
I am loo开发者_如何学Goking if there is an equivalent class of TimerTask from Java in C#?
The TimerTask of Java is referenced to here: http://download.oracle.com/javase/1.4.2/docs/api/java/util/TimerTask.html
The purpose of this is that I need to implement some code following in C#:
import java.util.Timer;
import java.util.TimerTask;
private static Timer timer = new Timer();
private TimerTask timeoutTask;
if (timeoutTime>0)
{
timeoutTask = new TimerTask() {
public void run()
{
// callActivity();
}
};
}
timer.schedule( timeoutTask, timeoutTime);
If you could provide me an equivalent code in C#, that would be great!
If you just need the timer to wait some interval, you might want want one of .Net's Timers:
- System.Windows.Forms.Timer
- System.Threading.Timer
- System.Timers.Timer
(the first one is easier to use with Forms).
精彩评论