/// <summary> /// Returns the Card object with the requested index if the index is valid; /// otherwise, throws an exception /// </summary> /// <param name="cardNum"></param> /// <returns></returns> public PlayingCard GetCard(int cardNum) { // Return the requested card if the index is within the range if (cardNum >= 0 && cardNum <= cards.Count - 1) { return(cards[cardNum]); } // Otherwise, throw an exception else { throw new CardOutOfRangeException(cards.Clone() as Cards); } }
public Card GetCard(int cardNum) { if (cardNum >= 0 && cardNum <= 51) { if ((cardNum == 51) && (LastCardDrawn != null)) { LastCardDrawn(this); } return(cards[cardNum]); } else { throw new CardOutOfRangeException((Cards)cards.Clone()); } }