Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 468 Bytes

vi.g.3-parallelforeach.md

File metadata and controls

16 lines (12 loc) · 468 Bytes

VI.G.3 ParallelForEach

ParallelForEach should be used to parallelize a loop that iterates over a collection that supports the usual enumerator pattern. Below is an example that iterates over a list of file names.

[Example:

List<string> files = ...;
new ParallelForEach(files).Run( delegate(filename) {
    FileStream f = new FileStream( filename, FileMode.Open );
    ...read file f and process it...
    f.Close();
});

end example]