Beispiel #1
0
 public bool Equals(Card?other)
 {
     return(other != null &&
            DeckNo.Equals(other.DeckNo) &&
            Suit.Equals(other.Suit) &&
            Rank.Equals(other.Rank));
 }
Beispiel #2
0
        public Card(DeckNo deckNo, Suit suit, Rank rank)
        {
            if (!Enum.IsDefined(typeof(DeckNo), deckNo))
            {
                throw new ArgumentOutOfRangeException(nameof(deckNo));
            }

            if (!Enum.IsDefined(typeof(Suit), suit))
            {
                throw new ArgumentOutOfRangeException(nameof(suit));
            }

            if (!Enum.IsDefined(typeof(Rank), rank))
            {
                throw new ArgumentOutOfRangeException(nameof(rank));
            }

            DeckNo = deckNo;
            Suit   = suit;
            Rank   = rank;
        }