I have a dataTable that contains 4 columns. Then, I have a query to fileTable that I do it with EntityFramework
that returns another list.
Finally, I need to make a InnerJoin
between those two lists.
Clarification: I managed to do it with a loop, but it takes a long time. (What options do I have?)
For Each d As DataRow In dataTable.Rows
Dim s As String = d.Item("codigo")
If db.TieneProgramaUnaMAteria(s, d.Item(4)) Then
d.Item("Tiene Programa") = "SI"
Else
d.Item("Tiene Programa") = "NO"
End If
Next
My idea is to create an object, with the same number of properties as the DataTable has columns, and then fill a list by creating an object for each row of the dataTable.
Something like that (it's a pseudo code):
Dim listaProgramasBD = db.ProgramaFileTable_VSet.Any(Function(x) x.unc_path.Contains("\programas_ft\programasSubidosWeb\") andalso x.is_archive)
Dim listaDT As List(Of ProgramasLivianos) = dataTable.AsEnumerable.ToList()'<--- esta linea es la que no estoy sabiendo realizar.
Dim resultado = From l In listaProgramasBD , p In listaDT
Where l.name.Contains(p.codSiu)
Select p
In short, my question is how to do the following line in an efficient way
Dim listaDT As List(Of ProgramasLivianos) = dataTable.AsEnumerable.ToList()
Greetings
Edited: I have made a loop that would solve that question, to be able to continue with the system, but I would like to know if there is a more efficient way to do it, I paste the loop so that they have a more finished idea of what I need.
Dim lista As New List(Of ProgramasLivianos)
Dim p As New ProgramasLivianos
For Each r As DataRow In dataTable.Rows
p.codSiu = r.Item(0)
p.MateriaDelSiuID = r.Item(1)
p.nombre = r.Item(2)
p.nombre_Reducido = r.Item(3)
p.plan = r.Item(4)
Next
Return lista