0
Dim timer As New Timer
timer.Enabled = True
timer.Interval = 1000
timer.Tag = "TimeslipTimer_" & timeslip.id
AddHandler timer.Tick, AddressOf GlobalTimerTick
timer.Start()
中創建定時器我的問題是我怎麼能刪除那些,如果我需要?
目前我一直在尋找的定時器添加到列表中,類似下面,但我沒有工作了
dim timers as new list(of Timer)
For Each c As Timer In Timers
c.Dispose()
Timers.Remove(c)
Next
使用LINQ'Timers.ForEach(子(T)RemoveHandler t.Tick,AddressOf GlobalTimerTick:t.Dispose結束分):Timers.Clear()'確保YPU有'進口System.Linq' – Codexer