I would like to use the new Parallel.ForEach function to loop through the data and perform actions on each row. I am trying to convert the code below:
foreach(DataRow drow in dt.Rows) { ... Do Stuff ... }
To this code:
System.Threading.Tasks.Parallel.ForEach(dt.Rows, drow => { ... Do Stuff ... });
When I run the new code, I get an error message:
Type arguments to the method "System.Threading.Tasks.Parallel.ForEach (System.Collections.Generic.IEnumerable, System.Action)" cannot be taken out of use. Try explicitly specifying type arguments.
What is the correct syntax for this?
SchwartzE Aug 04 '10 at 18:25 2010-08-04 18:25
source share