Пример #1
0
        public void NewDeck()
        {
            //Destroy current Deck
            theCards.Clear();

            foreach (snap.Suit suit in Enum.GetValues(typeof(Suit)))
            {
                foreach (snap.Rank rank in Enum.GetValues(typeof(Rank)))
                {
                    Card c = new Card(rank, suit);
                    theCards.Add(c);
                }
            }
        }
Пример #2
0
        public Deck()
        {
            theCards = new ArrayList();

            // foreach loop says (for a Suit object (called) "suit"
            // iterate through all possible values in that type (Suit)
            foreach (snap.Suit suit in Enum.GetValues(typeof(Suit)))
            {
                foreach(snap.Rank rank in Enum.GetValues(typeof(Rank)))
                {
                    Card c = new Card(rank, suit);
                    theCards.Add(c);
                }
            }
        }