这是我的代码,我将匿名类型声明为select
:
var projectsByManagersAndMonths = projectDates
.Where(pd => pd.project.isEnabled)
.GroupBy(pd => new { pd.project.manager, pd.project.dtEnd.Value.Month })
.Select(group => new
{
Manager = group.Key.manager.displayName,
Month = group.Key.Month,
Projects = group.Select(pd => new
{
Count = group.Count(),
CostToComplete = group.Sum(pdd => pdd.totals.costToComplete),
TimeWorkable = new UserBillingRate(WS, group.Key.manager, new Period(start, end)).TimeWorkable,
StatusOfCharge = CostToComplete / TimeWorkable //IMPOSSIBLE
})
})
.ToList();
如果您查看我添加的行//IMPOSSIBLE
,我会尝试将上面刚刚计算的 2 个数据重用到相同的匿名类型中。
我怎样才能做到这一点?