I have an array of location with 6 values lets say arr_locations= [“A”,“B”,“C”,“D”,“E”,“F”] and a datatable variable which already has some data. Lets say this datatable has 3 rows so every location must be mapped to these 3 rows.
That means at the end the total rows in my datatable would be 3*6 = 18 rows.
(From d in dtOrig.AsEnumerable
From lo in arr_locations
Let ra = d.ItemArray.SkipLast(1).Append(lo).Cast(Of Object).toArray
Order by lo
Select r = dtResult.Rows.Add(ra)).CopyToDataTable
UPD1 - Bracket Fix
UPD2 - Beautified it with an adtional ordering
I also have to mention that if you look at the last column Description which is empty in input and in the output has values from the array. That’s the main crux.