July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Similarly to For loops, the Parallel class offers an implementation of For..Each loops for iterating items within a collection in parallel. Using the methods shown at the beginning of this section for retrieving thread information, simulate intensive processing and the measuring of elapsed time. Imagine you want to retrieve the list of image files in the user-level Pictures folder simulating an intensive processing over each filename. This task can be accomplished via a classic For..Each loop as follows:
Sub ClassicForEachTest() Dim allFiles = IO.Directory. EnumerateFiles("C:\users\alessandro\pictures") For Each fileName In allFiles Console.WriteLine(fileName & GetThreadId()) ...