如果自动重置设置为false,我的计时器会自动处理吗? [英] If the autoreset is set to false, will my timer be disposed automatically?

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

问题描述

我仅在应用程序中启动一次计时器:

I launch a timer only one time in my application:

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

因此AutoReset设置为false。在计时器结束时,会否自动调用dispose方法?

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

推荐答案

否,不会。 自动重置会简单地说明是否应使用Elapsed事件间隔每次或仅第一次触发。

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,我的计时器会自动处理吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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