July 2015
Intermediate to advanced
1300 pages
87h 27m
English
The first way of running tasks in parallel is calling the Parallel.Invoke shared method. This method can receive an array of System.Action objects as parameters, so each Action is translated by the runtime into a task. If possible, tasks are executed in parallel. The following example demonstrates how to perform three calculations concurrently:
'Requires an Imports System.Threading.Tasks directive Dim angle As Double = 150 Dim sineResult As Double Dim cosineResult As Double Dim tangentResult As Double Parallel.Invoke(Sub() Console.WriteLine(Thread.CurrentThread. ManagedThreadId) Dim ...