' High-performance background tasks
Imports System
Imports System.Threading
Module Program
Private timer As Timer
Sub Main()
' Start immediately (dueTime:=0), tick every 1000 ms
timer = New Timer(AddressOf Tick, Nothing, 0, 1000)
Console.WriteLine("Timer started. Press Enter to exit.")
Console.ReadLine()
End Sub
Private Sub Tick(state As Object)
Console.WriteLine("Tick: " & DateTime.Now)
End Sub
End Module
' run:
'
' Timer started. Press Enter to exit.
' Tick: 4/13/2026 9:26:07 AM
' Tick: 4/13/2026 9:26:08 AM
' Tick: 4/13/2026 9:26:09 AM
' Tick: 4/13/2026 9:26:10 AM
' Tick: 4/13/2026 9:26:11 AM
' Tick: 4/13/2026 9:26:12 AM
'