public Pair(List <Card> cards) { SortedCards = cards .GroupBy(c => c.CardValue) .SelectMany(group => group) .OrderByDescending(c => c.CardValue == SetOfCardsWithSameValue.WinningValue(cards, 2)) .ThenByDescending(c => c.CardValue) .ToList(); }
public List <Card> SortCards(List <Card> cards) { return(cards .GroupBy(c => c.CardValue) .SelectMany(group => group) .OrderByDescending(c => c.CardValue == SetOfCardsWithSameValue.WinningValue(cards, 2)) .ThenByDescending(c => c.CardValue) .ToList()); }