KeyValuePair deconstruction in ToDictionary

Viewed 72

Can I deconstruct KeyValuePair as lambda argument in ToDictionary method like it could be done in foreach? So, is there any possibility to write something like this:

dict.ToDictionary((key, value) => key, (key, value) => 2*value);
1 Answers

No, you have to write it like this:

var d = dict.ToDictionary(p => p.Key, p => p.Value * 2);
Related