我想每5分钟调用一次某个方法。 我该怎么做?
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("*** calling MyMethod *** ");
Console.ReadLine();
}
private MyMethod()
{
Console.WriteLine("*** Method is executed at {0} ***", DateTime.Now);
Console.ReadLine();
}
}
System.Threading.Timer
:这是一个.NET Framework中的类,用于创建计时器对象,以在一段时间后执行指定的回调函数。 - user703016