C# System.Threading.Timer的使用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ThreadTimerExam
{
class Program
{
static void Main(string[] args)
{
var timer = new System.Threading.Timer(TimerAction, null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(3));
Thread.Sleep(15000);
timer.Dispose();
Console.Read();
}
static void TimerAction(object obj)
{
Console.WriteLine("System.Threading.Timer {0:T}", DateTime.Now);
}
}
}