views:

80

answers:

1

How to get values from nested Dictionary using LINQ. Keys in the Dictionary are integer. Values of Dictionary are list of lists. Seconday level list is a list of array holding integer value. Thanks in advance.

+1  A: 
Dictionary<int, List<List<int[]>>> dictionary = ...
var values = dictionary.Values.SelectMany(x => x.SelectMany(y => y.SelectMany(z => z));

Edit: Didn't realize it was a list of lists, so modified to account for that.

Kirk Woll
@Kirk Woll: it should be in this way, Dictionary<int, List<List<Int[]>>>
Ravi
Thanks Kirk Woll it worked. This is fantastic place to get queries answered quick.
Ravi