Copy Dictionary content to a datarow object using LINQ

Hi Experts,
I want to copy contents from dictionary<Of string, Object> to a Datarow.
E.g. dictVar = new Dictionary(of String, Object) contains three entries

  1. Name: “ABC”
  2. Age: 10
  3. Address: “ABC Street”

Data row (drSampleRow)has exactly same columns (Name, Age, Address) extracted from say table dtSampleTable(Column1:Name, Column2: Age, Column3: Address) containing few more rows.

I have achieved it by using For each loop as shown below. However, I want to replace it with LINQ to achieve better performance.

For each (field in drSampleRow.Table.Columns)

Thanks in Advance,


find starter help here:
Dictionary_To_ExistingDataTable_AsDataRow.xaml (7.9 KB)

the XAML implements some Column structure checkts. A direct LINQ would look like this

(From cn In dtData.Columns.Cast(Of DataColumn).Select(Function (x) x.ColumnName).toArray
Select dictRow(cn)).toArray

it is returning an Object Array whic can be used within an add datarow