My WCF service function return type is Dictionary(Of String, String). So I have to convert my Dataset to Dictionary.
Here is my dataset example.
Account AccountNames
abc abc1
abc abc2
abc abc3
xyz xyz1
xyz xyz2
xyz xyz3
xyz xyz4
pqr pqr1
pqr pqr2
pqr pqr3
pqr pqr4
pqr pqr5
pqr pqr6
Using LINQ or without LINQ, How can I convert Dataset To Dictionary(Of String, String)
Regards,
RN
Assuming the 2nd column are the keys you can do this:
I don’t know if there will be a shortcut for linq.
Note: dictionary cannot contain duplicate keys, so if the 1st column corresponds the key and the 2nd column for the values, it is not possible.