>Is there any advantage to using Linq to iterate through the rows in a datatable, versus foreach?
I'm guessing that you mean is it better to use Linq to select a subset of Rows from a DataTable rather than iterating and selecting them using 'foreach' code ?
If so the answer might depend on what you are trying to select.
But, IMO. the Linq statement will be quicker and simpler to write - and require a lot less code.
OTOH if the selection criteria is simple then 'foreach' may give better performance.....
Any specific scenario in mind ?
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement