我的目标是获取linq查询AboriginalLnVal
的总和或值列,其中包含以下select语句:
select new { Loan = final.Key, Value = final.Sum(Created => Created.AppLoanAmount) }
下面我从查询中获取值的总和,我将其设置为单行linq表 并将其与现有的摘要表联系起来。
var sum = AboriginalLnVal.Sum(x => x.Value);
var TargetValue = new { Section = "2.1.2 (a)", Activity = "$ Value of Closed Deals by Aboriginal", Result = sum };
var TargetValueLinq = Enumerable.Repeat(TargetValue, 1);
combineFunction = combineFunction.Union(TargetValueLinq);
错误产生:
Error 2 'System.Collections.Generic.IEnumerable<AnonymousType#1>' does not
contain a definition for 'Union' and the best extension method overload
'Telerik.Windows.Data.QueryableExtensions.Union(System.Linq.IQueryable, System.Linq.IQueryable)'
has some invalid arguments
如果我能够得到一些很好的指导,我相信我必须转换总和以使其兼容但不完全确定,对此非常新。 System.Linq被称为