примерно такое надо.
var firstPlace =
from user in usersOrderByScore
group new UserWithPlace(user.UserId, user.Score)
by user.Score >= leaderboardMinScores.FirstPlaceMinScore into firstPlaces,
by user.Score >= leaderboardMinScores.SecondPlaceMinScore
&& user.Score < leaderboardMinScores.FirstPlaceMinScore into secondPlaces,
by user.Score >= leaderboardMinScores.ThirdPlaceMinScore
&& x.Score < leaderboardMinScores.SecondPlaceMinScore into thirdPlaces,
by user.Score < leaderboardMinScores.ThirdPlaceMinScore into otherPlaces
select firstPlaces, secondPlaces, thirdPlaces, otherPlaces;
но не пойму как мне сделать группировки по нескольким параметрам. Такое вообще возможно?
сам же и ответил) вот так вроде бы var firstPlace = usersOrderByScore.GroupBy(user => { if (user.Score >= leaderboardMinScores.FirstPlaceMinScore) return PrizePlaceEnum.First; if (user.Score >= leaderboardMinScores.SecondPlaceMinScore && user.Score < leaderboardMinScores.FirstPlaceMinScore) return PrizePlaceEnum.Second; if (user.Score >= leaderboardMinScores.ThirdPlaceMinScore && user.Score < leaderboardMinScores.SecondPlaceMinScore) return PrizePlaceEnum.Third; return PrizePlaceEnum.Other; });
Обсуждают сегодня