Combining Two IEnumerables of UiElements into a Single DataTable with LINQ

I have scrapped two IEnumerables of UIElements, and wish to store the details inside of a Data Table.

Here are few screenshots for your reference:

ienumerablelist2 Ienumerablelist1

As you can see, I am able to extract the required data properly, but I am having a hard time combining them into a single DataTable. This is what I tried, and it failed.


This is obviously wrong, since I am using two From operators, which forces it to operate as a loop inside of another loop.

Help would be most appreciated.
Thanks in advance!

Kind Regards,
Ashwin A.K

lets assume

  • both Lists have reliable same count of items
  • the datatable col structure is 2 cols (name,adress) and an empty datatable is available - dtFinal

Give a try on

(From i in Enumerable.Range (0, ListName.Count)
Let ra = {ListName,ListAddr}.Select(Function (x) x(i).Get(“innertext”)).toArray
Select dtFinal.Rows.Add(ra)).CopyToDataTable

ListName = your List_UIElement of the names


Thank you so much @ppr, it worked like a charm! :grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.