我有一个控制台应用程序,并在主要的方法,我有这样的代码:如何在完成运行后停止定时器?
Timer time = new Timer(seconds * 1000); //to milliseconds
time.Enabled = true;
time.Elapsed += new ElapsedEventHandler(time_Elapsed);
我只想让我的想法是,我应该停止在TIME_ELAPSED方法定时器定时运行一次。但是,由于我的计时器存在于Main()中,我无法访问它。
System.Timers.Timer而是或System.Windows.Forms.Timer? 请指定,因为我来这里是为了同一个问题,但答案是针对不同的计时器,并没有帮助。 – PandaWood 2016-07-12 01:40:12