Data table to Dictionary of array conversion

Can anyone help me to convert datatable to dictionary of array

I’ve list items in datatable format. I need to convert it to dictionary of array variable

Hi @Aarya_Sajeev ,

Could you maybe check with the below post :


Can you please show your final output needed

What should be the key and what should be the values?



dt1.AsEnumerable.ToDictionary(Function(x) x(0).tostring,Function(x) DirectCast(x(1),String()))

Hi @Aarya_Sajeev



Hope it helps!!

Hi @Aarya_Sajeev

Create a dictionary and initialize it
dictionary = New Dictionary(Of String, Object())

Use assign activity
dictionary = dt.AsEnumerable().ToDictionary(
Function(row) row(“YourKeyColumnName”).ToString(),
Function(row) row.ItemArray)

Hope this helps