Will this Timer be released from memory?

戏子无情 提交于 2019-12-05 03:01:00

The Threading.Dispatcher class keeps a list of all active DispatcherTimers. When you call Stop() in the Tick event handler then the timer will be removed from that list. There are now no longer any references to the timer. It will eventually be garbage collected. Which is okay because there is no way to get the timer started again. After all, you don't have any way to get the reference anymore, the Tick event handler was your last shot at it.

According to this, you'll have to call stop and remove the handler.

Basically a DispatcherTimer spawns a new Thread.So its scope cannot be defined as normally we would think. You could alternatively kill the thread by specific methods.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!