public void The_Hyphens_In_An_Isbn_Do_Not_Affect_Hashcode() { var one = new Isbn("978-0-123456789"); var other = new Isbn("9780123456789"); one.GetHashCode().Equals(other.GetHashCode()).Should().BeTrue(); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Isbn != null) { hashCode = hashCode * 59 + Isbn.GetHashCode(); } if (Titulo != null) { hashCode = hashCode * 59 + Titulo.GetHashCode(); } if (Autor != null) { hashCode = hashCode * 59 + Autor.GetHashCode(); } if (Genero != null) { hashCode = hashCode * 59 + Genero.GetHashCode(); } if (Data != null) { hashCode = hashCode * 59 + Data.GetHashCode(); } if (Preco != null) { hashCode = hashCode * 59 + Preco.GetHashCode(); } return(hashCode); } }
/// <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()); }
public override int GetHashCode() { int result = base.GetHashCode(); result = (result * 397) ^ Title.GetHashCode(); result = (result * 397) ^ Author.GetHashCode(); result = (result * 397) ^ Isbn.GetHashCode(); result = (result * 397) ^ Year.GetHashCode(); return(result); }
public override int GetHashCode() { unchecked { var hashCode = Id.GetHashCode(); hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Author != null ? Author.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Isbn != null ? Isbn.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsLoaned.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int result = base.GetHashCode(); result = (result * 397) ^ LibraryId.GetHashCode(); result = (result * 397) ^ LibraryName.GetHashCode(); result = (result * 397) ^ LibraryPicture.GetHashCode(); result = (result * 397) ^ Title.GetHashCode(); result = (result * 397) ^ Author.GetHashCode(); result = (result * 397) ^ Isbn.GetHashCode(); result = (result * 397) ^ PublishYear.GetHashCode(); return(result); }
public override int GetHashCode() { const int number = 15; int hashCode = 3; hashCode = hashCode * Isbn.GetHashCode() + number; hashCode = hashCode * Author.GetHashCode() + number; hashCode = hashCode * Name.GetHashCode() + number; hashCode = hashCode * Edition.GetHashCode() + number; hashCode = hashCode * EditionYear.GetHashCode() + number; hashCode = hashCode * Pages.GetHashCode() + number; hashCode = hashCode * Price.GetHashCode() + number; return(hashCode); }
/// <summary> Calculate hash code.</summary> /// <returns>Hash code.</returns> public override int GetHashCode() { var hashCode = 352033288; hashCode = (hashCode * -1521134295) + Isbn.GetHashCode(); hashCode = (hashCode * -1521134295) + Name.GetHashCode(); hashCode = (hashCode * -1521134295) + Author.GetHashCode(); hashCode = (hashCode * -1521134295) + Publisher.GetHashCode(); hashCode = (hashCode * -1521134295) + PublicationYear.GetHashCode(); hashCode = (hashCode * -1521134295) + Price.GetHashCode(); hashCode = (hashCode * -1521134295) + PageCount.GetHashCode(); return(hashCode); }
public override int GetHashCode() { unchecked { var hashCode = (Isbn != null ? Isbn.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Authors != null ? Authors.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PubCity != null ? PubCity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PubName != null ? PubName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PubYear.GetHashCode(); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Note != null ? Note.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CountPages; return(hashCode); } }
public override int GetHashCode() { int hash = 1; if (Isbn != 0L) { hash ^= Isbn.GetHashCode(); } if (Title.Length != 0) { hash ^= Title.GetHashCode(); } if (Author.Length != 0) { hash ^= Author.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { return(31 * Isbn.GetHashCode()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Upc != null) { hashCode = hashCode * 59 + Upc.GetHashCode(); } if (Ean != null) { hashCode = hashCode * 59 + Ean.GetHashCode(); } if (Isbn != null) { hashCode = hashCode * 59 + Isbn.GetHashCode(); } if (Asin != null) { hashCode = hashCode * 59 + Asin.GetHashCode(); } if (Title != null) { hashCode = hashCode * 59 + Title.GetHashCode(); } if (Sku != null) { hashCode = hashCode * 59 + Sku.GetHashCode(); } if (Mpn != null) { hashCode = hashCode * 59 + Mpn.GetHashCode(); } if (PartNumber != null) { hashCode = hashCode * 59 + PartNumber.GetHashCode(); } if (Upcs != null) { hashCode = hashCode * 59 + Upcs.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } if (Brand != null) { hashCode = hashCode * 59 + Brand.GetHashCode(); } if (Manufacturer != null) { hashCode = hashCode * 59 + Manufacturer.GetHashCode(); } if (Color != null) { hashCode = hashCode * 59 + Color.GetHashCode(); } hashCode = hashCode * 59 + NewPrice.GetHashCode(); hashCode = hashCode * 59 + UsedPrice.GetHashCode(); if (CurrencyCode != null) { hashCode = hashCode * 59 + CurrencyCode.GetHashCode(); } if (Url != null) { hashCode = hashCode * 59 + Url.GetHashCode(); } if (Features != null) { hashCode = hashCode * 59 + Features.GetHashCode(); } if (Dimensions != null) { hashCode = hashCode * 59 + Dimensions.GetHashCode(); } if (Images != null) { hashCode = hashCode * 59 + Images.GetHashCode(); } if (MatchedItems != null) { hashCode = hashCode * 59 + MatchedItems.GetHashCode(); } if (IsoCountryCodes != null) { hashCode = hashCode * 59 + IsoCountryCodes.GetHashCode(); } if (CompanyName != null) { hashCode = hashCode * 59 + CompanyName.GetHashCode(); } if (CompanyAddress != null) { hashCode = hashCode * 59 + CompanyAddress.GetHashCode(); } if (Categories != null) { hashCode = hashCode * 59 + Categories.GetHashCode(); } if (CategoryHierarchies != null) { hashCode = hashCode * 59 + CategoryHierarchies.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { return(2140778025 + Isbn.GetHashCode()); }
/// <summary> /// Returns book hash code. /// </summary> /// <returns>Book hash code.</returns> public override int GetHashCode() => Isbn.GetHashCode();