Asking for a better way of Dividing Datable and Looping in them

I hope now i understood your issue.

Yes you can just go with only one foreach please…

Don’t even split the DT (which you did with linq previously)

  1. From the master DT, iterate through ForeachRow

  2. Inside that add an if block to find foriegn or other currency, based on that you can add respective currency activities in true & others in else block.

This way will have one foreach with actual business logic for both currency types inside based on a condition.


1 Like