/// <summary> /// Gets Hash Code for current Book instance. /// </summary> /// <returns> Hash Code</returns> public override int GetHashCode() { int hash = ((((Author.GetHashCode() * 31 + Title.GetHashCode()) * 31 + PublishingHouse.GetHashCode()) * 31 + Year.GetHashCode()) * 31 + Genre.GetHashCode()) * 31; return(hash); }
/// <summary> /// Serves as the default hash function /// </summary> public override int GetHashCode() { unchecked { var hashCode = Name?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (Author?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (PublishingHouse?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ Year.GetHashCode(); hashCode = (hashCode * 397) ^ (Language?.GetHashCode() ?? 0); return(hashCode); } }
public override int GetHashCode() { return(ISBN.GetHashCode() + Author.GetHashCode() + Name.GetHashCode() + PublishingHouse.GetHashCode() + YearPublish.GetHashCode() + PageCount.GetHashCode() + Price.GetHashCode()); }