开发者

C#: is there an equivalent class of TimerTask from Java in C#? [duplicate]

This question already has answers here: Closed 12 years ago.

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜