DelegatesからParallel.ForEachに変更しようとしています
以下は問題なく動作するようです。
Imports System.Threading.Tasks
Sub Main()
Dim secs() As Integer = {2, 3, 1}
Parallel.ForEach(secs, AddressOf Method2)
End Sub
Sub Method2(ByVal i As Integer)
Console.WriteLine(i.ToString)
End Sub
しかし、Subが複数の変数を受け取る場合はどうなりますか?以下の方法を教えていただけますか?
Imports System.Threading.Tasks
Sub Main()
Dim secs() As Integer = {2, 3, 1}
Dim Path as String = "Constant"
Parallel.ForEach(secs, Path, AddressOf Method2)
End Sub
Sub Method2(ByVal i As Integer, path as string )
Console.WriteLine(i.ToString, path)
End Sub
ありがとうございました