Exemple #1
0
        public override int GetHashCode()
        {
            var hashCode = 746792037;

            hashCode = hashCode * -1521134295 + CardRank.GetHashCode();
            hashCode = hashCode * -1521134295 + Suit.GetHashCode();
            return(hashCode);
        }
Exemple #2
0
        public void TestGetHashCodeEqualRanks()
        {
            var ace  = new CardRank(CardRank.RankNames.Ace);
            var ace2 = new CardRank(CardRank.RankNames.Ace);

            bool equals = (ace.GetHashCode() == ace2.GetHashCode());

            Assert.True(equals);
        }
Exemple #3
0
 /// <summary>
 /// Serves as a hash function for a <see cref="T:Cards.Card"/> object.
 /// </summary>
 /// <returns>
 ///     A hash code for this instance that is suitable for use in
 ///     hashing algorithms and data structures such as a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(Suit.GetHashCode() ^ Rank.GetHashCode());
 }