草庐IT

UserIsFollowingQuestion

全部标签

c# - 使用 LINQ 选择最频繁的值

我试图在我的表中选择前五个最常见的值并将它们返回到一个列表中。varmostFollowedQuestions=(fromqincontext.UserIsFollowingQuestionselect*topfiveoccuringvaluesfromq.QuestionId*).toList();有什么想法吗?谢谢 最佳答案 varmostFollowedQuestions=context.UserIsFollowingQuestion.GroupBy(q=>q.QuestionId).OrderByDescending(gp=

c# - 使用 LINQ 选择最频繁的值

我试图在我的表中选择前五个最常见的值并将它们返回到一个列表中。varmostFollowedQuestions=(fromqincontext.UserIsFollowingQuestionselect*topfiveoccuringvaluesfromq.QuestionId*).toList();有什么想法吗?谢谢 最佳答案 varmostFollowedQuestions=context.UserIsFollowingQuestion.GroupBy(q=>q.QuestionId).OrderByDescending(gp=