Exemplo n.º 1
0
        public static string PrintFormat(this IEnumerable <Card> cards)
        {
            if (cards == null)
            {
                return("<null>");
            }

            var sb = new StringBuilder();

            foreach (var suit in Deck.Suits)
            {
                sb.AppendLine();
                sb.Append(Card.SuitToGlyph(suit));
                //TODO - investigate resharper comments
                //suit: Access to modified closure; <Card,Rank> redundant; possible multiple enumerations of cards
                //var suit1 = suit
                //foreach (var card in cards.Where(c => c.Suit == suit1).OrderByDescending(c => c.Rank))
                foreach (var card in cards.RankOrderSuit(suit))
                {
                    sb.Append(" " + Card.RankToString(card.Rank));
                }
            }
            return(sb.ToString());
        }
Exemplo n.º 2
0
 public override string ToString()
 {
     return(string.Format("{0}{1}", Tricks, Card.SuitToGlyph(Suit)));
 }