I have a data table with columns “a”, “b”, “c”. a and b are my lookup keys, and so I want to find c.
I’d like to use linq to convert it to a Dictionary<a, Dictionary<b, c>> (or an ILookup)
Is this possible?
The closet workaround I can come up with is:
var lookup = resultTable.AsEnumerable().ToLookup(row => row["a"] & row["b"],
row => row["c"]);
and then I can concatenate a+b to use as the key.
Is there a better way, or is this possibly faster anyways due to it being a simpler data structure?
Here’s one way you could do it in C#:
And equivalent VB: