【发布时间】:2010-12-03 05:04:23
【问题描述】:
我已经看到 .net Aggregate 函数的简单示例是这样工作的:
string[] words = { "one", "two", "three" };
var res = words.Aggregate((current, next) => current + ", " + next);
Console.WriteLine(res);
如果您希望聚合更复杂的类型,如何使用“聚合”函数? 例如:一个具有 2 个属性的类,例如 'key' 和 'value',你想要这样的输出:
"MyAge: 33, MyHeight: 1.75, MyWeight:90"
【问题讨论】:
标签: .net asp.net linq string-concatenation