我看过这个简单的例子.净聚合函数的工作原理如下:
string[] words = { "one", "two", "three" };
var res = words.Aggregate((current, next) => current + ", " + next);
Console.WriteLine(res);
如果您希望聚合更复杂的类型,如何使用"Aggregate"函数呢? 例如:一个具有两个属性(如‘key’和‘value’)的类,并且您希望输出如下所示:
"MyAge: 33, MyHeight: 1.75, MyWeight:90"