Language: Add new Watch class

This commit is contained in:
Jonathan Jenne
2020-11-20 16:09:42 +01:00
parent d0e4ecb4ed
commit cd24795a0b
2 changed files with 24 additions and 0 deletions

23
Modules.Language/Watch.vb Normal file
View File

@@ -0,0 +1,23 @@
Public Class Watch
Private ReadOnly _StopWatch As Stopwatch
Private ReadOnly _Name As String
Public Sub New(pName As String)
_StopWatch = New Stopwatch()
_StopWatch.Start()
_Name = pName
Debug.WriteLine($"Starting [{pName}].")
End Sub
Public Sub Restart()
_StopWatch.Restart()
Debug.WriteLine($"Starting [{_Name}].")
End Sub
Public Sub [Stop]()
_StopWatch.Stop()
Debug.WriteLine($"Stopped [{_Name}] after {_StopWatch.Elapsed.TotalSeconds} seconds.")
End Sub
End Class