【发布时间】:2014-07-02 19:59:53
【问题描述】:
我有这两个错误:
“System.Array”不包含“Aggregate”的定义,也没有 扩展方法“聚合”接受类型的第一个参数 可以找到“System.Array”(您是否缺少 using 指令或 程序集参考?)
'System.Collections.Generic.IEnumerable
这是我的代码:
/*
* Get all the possible permutations
*/
public static IEnumerable<object[]> CartesianProduct(params object[][] inputs)
{
//ERROR: Function Aggregate is not recognized
return inputs.Aggregate(
(IEnumerable<object[]>)new object[][] { new object[0] },
(soFar, input) =>
from prevProductItem in soFar
from item in input
select prevProductItem.Concat(new object[] { item }).ToArray());
}
public void test()
{
//Get all the posible permutations between parents values.
var cartesianProduct = CartesianProduct(parentsValues);
object[][] producto = cartesianProduct.ToArray();
//ERROR: Function ToArray is not recognized
}
【问题讨论】:
标签: c# .net .net-4.5 ienumerable system.array