Ejemplo n.º 1
0
    public DeckOfCards()
    {
        // build the deck of cards once...
        // Start going through each suit
        foreach (CardSuit s in typeof(CardSuit).GetEnumValues())
        {
            // now go through each card within each suit
            foreach (CardFace f in typeof(CardFace).GetEnumValues())
            {
                // Now, add a card to the deck of the suite / face card
                SingleDeck.Add(new SingleCard {
                    Face = f, Suit = s
                });
            }
        }

        // so now you have a master list of all cards in your deck declared once...
    }