I would like to use the new Parallel.ForEach function to loop through a datatable and perform actions on each row. I am trying to convert the code below:
This is better than the accepted answer because this does not need to reference System.Data.DataSetExtensions:
Parallel.ForEach(dt.Rows.Cast(), dr =>
To use ForEach with a non-generic collection, you can use the Cast extension method to convert the collection to a generic collection, as shown in this example.