예제 #1
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(Isbn.GetHashCode() ^
            Author.GetHashCode() ^
            Title.GetHashCode() ^
            Publisher.GetHashCode() ^
            PublishingYear.GetHashCode() ^
            PagesNumber.GetHashCode() ^
            Price.GetHashCode());
 }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked {
         const int randomPrime = 397;
         int       hashCode    = Id.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Author != null ? Author.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (PublishingYear != null ? PublishingYear.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (TimeInterval != null ? TimeInterval.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Language != null ? Language.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #3
0
        public override int GetHashCode()
        {
            var hashCode = 785420666;

            hashCode = (hashCode * -1521134295) + EqualityComparer <string> .Default.GetHashCode(_isbn);

            hashCode = (hashCode * -1521134295) + EqualityComparer <string> .Default.GetHashCode(_author);

            hashCode = (hashCode * -1521134295) + EqualityComparer <string> .Default.GetHashCode(_title);

            hashCode = (hashCode * -1521134295) + EqualityComparer <string> .Default.GetHashCode(_publisher);

            hashCode = (hashCode * -1521134295) + _pagesCount.GetHashCode();
            hashCode = (hashCode * -1521134295) + _price.GetHashCode();
            hashCode = (hashCode * -1521134295) + PublishingYear.GetHashCode();
            return(hashCode);
        }