タイトル : Re^3: System.Threading.Timeクラス? 投稿日 : 2009/01/07(Wed) 18:23 投稿者 : 花ちゃん
> 1.System.Timers.Timer()とSystem.Threading.Timerは同じものでしょうか? 失礼しました、いつの間にか違うリンク先を参照していました。 Public Class Form1 Private count As Integer = 0 Private timer As System.Threading.Timer Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim timerDelegate As Threading.TimerCallback = New Threading.TimerCallback(AddressOf MyClock) timer = New Threading.Timer(timerDelegate, Nothing, 0, 1000) End Sub Public Sub MyClock(ByVal o As Object) count += 1 Debug.WriteLine(count.ToString) End Sub Private Sub Button2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button2.Click timer.Dispose() End Sub End Class >2.GC.KeepAlive の説明で 詳しくは、私も知りませんが、MSDN のサンプルで使用されていたので付加しました。 使用したメモリの解放処理に関する処理だと思います。無くても問題ないかも?。 |