I am planning to use Parallel.ForEach on a DataTable so that each record can be written to a file.
How can we notify user the percentage/number of records that are processed.
Normally when we use Background worker we have a ProgressChanged event where the user is notified on the percentage of work done. How can we achieve this using Parallel.ForEach or Multiple tasks?
Thanks, Bunny
You will need a (shared) counter that starts at 0 and that you increment (with Interlocked) at the end of each part.
And then you need to
Option 2) is easier and much more efficient when the number of iterations is large.