I have one value in String and another in Number.
I wanto get the DataTable as Dictionary
Help me out.
I have one value in String and another in Number.
I wanto get the DataTable as Dictionary
Help me out.
@Parvathy
I have Datatable with one value in string and another is of Number.
Need Linq Query to convert it into Dictionary
Hi @SP_Bot
DT.AsEnumerable.ToDictionary(Function(x) x("Key").ToString, Function(y) y("Value"))

Hope it’ll helps you ![]()
Cheers!!
Hi @SP_Bot
Try this query:
dtDictionary.AsEnumerable().ToDictionary(Of String, Integer)(Function(row) row.Field(Of String)("StringColumn"), Function(row) Convert.ToInt32(row.Field(Of Object)("NumberColumn")))
Output DataType is System.Collections.Generic.Dictionary(Of String, Integer)
Hope it helps!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.