循环执行的类timer

using System;
using System.Collections.Generic;
using System.Text;

namespace Timer
{
    public class TimerManager
    {
        System.Timers.Timer t = new System.Timers.Timer(20000); //实例化Timer类,设置间隔时间为10000毫秒
        public TimerManager()
        {
            t.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;   
            t.AutoReset = true; //设置是执行一次(false)还是一直执行(true);   
            t.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
        }

        //循环执行的方法
        public void theout(object source, System.Timers.ElapsedEventArgs e)
        {

        }
    }
}
原文地址:https://www.cnblogs.com/maijin/p/2824659.html