Exemple #1
0
 public void AddAllCardsFromInSomeOrder(CollectionCards other)
 {
     base.AddAllCardsFrom(other);
     foreach (Card card in other.AllTypes)
     {
         int count = other.CountOf(card);
         for (int i = 0; i < count; ++i)
         {
             this.cards.Add(card);
         }
     }
 }
Exemple #2
0
        private void WriteAllCards(CollectionCards cards)
        {
            bool needComma = false;

            foreach (Card currentCard in cards.AllTypes.OrderBy(card => card.name))
            {
                int cardCount = cards.CountOf(currentCard);
                if (!needComma)
                {
                    needComma = true;
                }
                else
                {
                    this.textWriter.Write(", ");
                }
                this.textWriter.Write("{0} {1}", cardCount, cardCount > 1 ? currentCard.pluralName : currentCard.name);
            }
            this.textWriter.WriteLine();
        }