I need to convert a dictionary
into a list
so that I can bind it to a grid.
My dictionary
has string
as a key, and an array
of doubles
as a value.
I can convert the dictionary
to a list
by using the ToList<>
function on the dictionary
, but when I bind it to the grid, the array
is displayed as an object in the grid column.
How can I add the values in the array
of doubles
to the list
? Is there a way for me to extract the array
values into the list at the same time as I'm converting the dictionary
to a list
?
This is what I'm currently doing:
List<KeyValuePair<string, double[]>> dataList =
dataDictionary.ToList<KeyValuePair<string, double[]>>();
I need to preserve the string
and both double
values in the array
(the array of doubles is of size two) to display in the grid.
I have looked at this, but couldn't implement it for what I need: Convert dictionary to List<KeyValuePair>
Any suggestions or help would be greatly appreciated.
Thanks in advance,
Marwan
PS - I have also thought about converting the dictionary
to a datatable
so that I can bind it to the grid, but I'm not sure if that's doable.