如果自动复位设置为false,将我的定时器automaticaly处置? [英] If the autoreset is set to false, will my timer be disposed automaticaly?

查看:118
本文介绍了如果自动复位设置为false,将我的定时器automaticaly处置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我启动一个定时器只有一次在我的应用程序:

I launch a timer only one time in my application :

CustomTimer timer = new CustomTimer(mod);
timer.Interval = interval.TotalMilliseconds;
timer.AutoReset = false;
timer.Start();



所以自动复位设置为false。在计时结束后,将Dispose方法被自动调用?

So the AutoReset is set to false. At the end of the timer, will the dispose method be called automatically ?

推荐答案

没有它不会。 自动复位将简单说明是否经过的事件应仅在第一次每次被触发的时间间隔过去时,或。

No it will not. AutoReset will simply state whether the Elapsed event should be triggered each time the interval elapses, or only the first time.

您可以如挂钩事件处理程序的 Tick事件,做任何处理需要。

You can e.g. hook up an event handler to the Tick event and do whatever disposing you need to.

这篇关于如果自动复位设置为false,将我的定时器automaticaly处置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆