【发布时间】:2019-06-18 08:56:39
【问题描述】:
我正在使用此代码在单独的线程上执行一次我的代码,延迟 10 秒。
System.Threading.Timer timer = null;
timer = new System.Threading.Timer(e=> {
//My code
timer.Dispose();
},null,10000,System.Threading.Timeout.Infinite);
我想问一下,完成任务后是否需要使用timer.Dispose(),否则定时器会自动释放。
【问题讨论】:
-
根据this你应该。
标签: c# multithreading timer