Every time that I want to make a thread in the ThreadPool I make a stupid little function like Worker_O below.
Sub Worker(ByVal i As Integer)
'do important stuff
End Sub
Sub Worker_O(ByVal o as Object)
Worker(CType(o, Integer))
End Sub
Sub MakeThread()
Dim worker1 as new Threading.WaitCallback(AddressOf Worker_O))
Threading.ThreadPool.QueueUserWorkItem(worker1)
End Sub
Is there a way in VB .net to cast from Sub(i as integer) to Sub(o as object) without making Worker_O? Worker_O is ugly to me.
Edit: I'm using Option Explicit On and all warnings are errors, like a good programmer should.