我想我正在回答here,但这一切都有点不对 - 我似乎只是将数字5传递给每个帖子!
我在这里做错了什么?一旦调用了sub,参数值是否应该固定?
Public Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ji As Integer, tasks As New List(Of Task)()
For ji = 0 To 4
tasks.Add(Task.Run(Sub() findPageCount(ji)))
Next
Await Task.WhenAll(tasks)
end sub
Sub findPageCount(ByVal iAmThread As Integer)
Debug.Print("I am thread " & iAmThread)
'...lots more stuff...
end sub