/// <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 (Nome != null) { hashCode = hashCode * 59 + Nome.GetHashCode(); } if (Preco != null) { hashCode = hashCode * 59 + Preco.GetHashCode(); } if (Autor != null) { hashCode = hashCode * 59 + Autor.GetHashCode(); } if (Editora != null) { hashCode = hashCode * 59 + Editora.GetHashCode(); } if (Categora != null) { hashCode = hashCode * 59 + Categora.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = (ISBN != null ? ISBN.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PublisherId; hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ReleaseDate.GetHashCode(); hashCode = (hashCode * 397) ^ (AgeRestriction != null ? AgeRestriction.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { int hash = 13; hash = hash * 7 + Title.GetHashCode(); hash = hash * 7 + Author.GetHashCode(); hash = hash * 7 + ISBN.GetHashCode(); hash = hash * 7 + Publisher.GetHashCode(); hash = hash * 7 + PublishYear.GetHashCode(); hash = hash * 7 + Price.GetHashCode(); hash = hash * 7 + Pages.GetHashCode(); return(hash); }
/// <summary> /// The constructor for Book instances /// </summary> public Book() { ID = Guid.NewGuid().ToString(); IsAvailable = true; AvailableWhen = DateTime.Now; // data integrity // rafal-is-coding => 34fdtdg123871yrty // rafa-is-coding => 7812783hg312jhdud9 // take some properties - andmake a....? ISBN.GetHashCode(); }
/// <inheritdoc /> public override int GetHashCode() { unchecked { var hashCode = ISBN != null?ISBN.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (Author != null ? Author.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PublishingOffice != null ? PublishingOffice.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Year; hashCode = (hashCode * 397) ^ NumberOfPages; hashCode = (hashCode * 397) ^ Price.GetHashCode(); return(hashCode); } }
/// <summary> /// Returns the hash code for this instance /// </summary> /// <returns>The hash code for this instance</returns> public override int GetHashCode() { var hashCode = -2110119757; hashCode = hashCode * -1521134295 + ISBN.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Author); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PublishingHouse); hashCode = hashCode * -1521134295 + Year.GetHashCode(); hashCode = hashCode * -1521134295 + PageNum.GetHashCode(); return(hashCode); }
public override int GetHashCode() { return(ISBN.GetHashCode()); }
public override int GetHashCode() => ISBN.GetHashCode();
/// <summary> /// Une des règles de conception veut que l'on modifie la méthode GetHashCode /// Si la méthode Equals est modifiée /// </summary> /// <returns></returns> public override int GetHashCode() { // Uniquement si non nul return((ISBN != null) ? ISBN.GetHashCode() : 0); }
public override int GetHashCode() { return((ISBN != null) ? ISBN.GetHashCode() : 0); }
public override int GetHashCode() { return(ISBN.GetHashCode() + Author.GetHashCode() + Name.GetHashCode() + PublishingHouse.GetHashCode() + YearPublish.GetHashCode() + PageCount.GetHashCode() + Price.GetHashCode()); }
public override int GetHashCode() { return(ISBN.GetHashCode() + Author.GetHashCode() + Title.GetHashCode()); }