May 2010
Intermediate to advanced
1272 pages
61h 18m
English
Parallel.ForEach LoopSimilarly to For loops, the Parallel class offers an implementation of For..Each loops for iterating items within a collection in parallel. Still taking advantage of methods shown at the beginning of this section for retrieving thread information, simulate intensive processing and measuring 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:

The intensive processing simulation still relies on a single thread and on a single processor, thus it will be ...
Read now
Unlock full access