-1

How i can use Parallel.ForEach with DataTable it works fine with List and array but i cant get it working with DataTable it shows Error "Cannot be inferred from the usage. Try specifying the type arguments explicitly"

 Parallel.ForEach(dt.Rows , row=>
                {
                  //code here  

                }); 
Malik Rizwan
  • 759
  • 1
  • 10
  • 31

1 Answers1

0

The answer is that You need to cast a row with AsEnumerable() extension method:

 Parallel.ForEach(dt.Rows.AsEnumerable() , row=>
            {
              //code here  

            }); 
MajkeloDev
  • 1,661
  • 13
  • 30