1
以下Average需求的LINQ语法是什么? Select和SelectMany都让我失望。 我可以Max()和Sum()我的内部列表,但Average()不会编译。LINQ如何平均内部列表
简单列表的JSON版本看起来像
[{"Week":6, "Matches":[{"Game":189},{"Game":149},{"Game":132}]} ....
var hiGame = games.Max(g => g.Matches.Max(m => m.Game)); // ok
var hiSeries = games.Max(g => g.Matches.Sum(m => m.Game)); // ok
var ave = games.Average(g => g.Matches.SelectMany(m => m.Game)); // no go
的类型参数方法 'System.Linq.Enumerable.SelectMany(System.Collections.Generic.IEnumerable,System.Func>)' 不能从使用推断。尝试明确指定类型参数。