Reputation: 51
I have problem with select dicionary from dictionares,
my structure Dictionary<long, Dictionary<long, object>>
i try Select(x => x.Value) and SelectMany(x => x.Value)
but result is IEnuerable<Dictionary<long, object>>
do you have any ideas, how can i select this dictionary?
Upvotes: 0
Views: 101
Reputation: 4260
Select and SelectMany will result in
IEnumerable
try with SelectMany
and then convert to desired Dictionary
var result = dd.SelectMany(x => x.Value)
.ToDictionary(x => x.Key, y => y.Value);
Upvotes: 0
Reputation: 159
Select returns an IEnumerable
, so you should either do .FirstOrDefault()
on the result, or use a method like TryGetValue
Upvotes: 1