如:
每隔十秒
console("test")
?
谢谢

解决方案 »

  1.   

    System.Threading.Timer aTimer=new System.Threading.Timer(new System.Threading.TimerCallback(aTimer_Elapsed),base.Context,0,10000);
      

  2.   

    不好意思,偶是新人,在哪儿Console呢?
      

  3.   

    using System;
    using System.Threading;class TestTimer
    {
      public static void MyTimerCallback(object state)
      { Console.WriteLine("{0} at {1} from {2}", AppDomain.GetCurrentThreadId(), DateTime.Now, state);  }  public static void Main()
      {
    long Interval = 10*1000; //10 seconds
    System.Threading.Timer t = new System.Threading.Timer(new TimerCallback(MyTimerCallback),"MyTimer",0,Interval);

    Console.WriteLine("{0} at {1}", AppDomain.GetCurrentThreadId(), DateTime.Now);
    Console.ReadLine();
      }
    }