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);
CodePudding user response:
No, you have to write it like this:
var d = dict.ToDictionary(p => p.Key, p => p.Value * 2);