我想知道是否有可能做这样的事情 . 我添加了多个键,其中一个键来自方法调用let . 我不知道如何将 category 整合到组中
o group by o {category,o.City}
var query = from o in Feedbacks.ToList()
where o.FeedbackID > 1236
let category = Category(o.RecommendationScore)
group o by {category, o.City} into scores
select new{
scores,
count = scores.Count()
};
public string Category( int score )
{
if(score == 10 || score == 9)
return "Promoters";
else if(score == 8 || score == 7 )
return "Neutrals";
else
return "Critici";
}