/// <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); } }
/// <summary> /// Returns true if Item instances are equal /// </summary> /// <param name="other">Instance of Item to be compared</param> /// <returns>Boolean</returns> public bool Equals(Item other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Upc == other.Upc || Upc != null && Upc.Equals(other.Upc) ) && ( Ean == other.Ean || Ean != null && Ean.Equals(other.Ean) ) && ( Isbn == other.Isbn || Isbn != null && Isbn.Equals(other.Isbn) ) && ( Asin == other.Asin || Asin != null && Asin.Equals(other.Asin) ) && ( Title == other.Title || Title != null && Title.Equals(other.Title) ) && ( Sku == other.Sku || Sku != null && Sku.Equals(other.Sku) ) && ( Mpn == other.Mpn || Mpn != null && Mpn.Equals(other.Mpn) ) && ( PartNumber == other.PartNumber || PartNumber != null && PartNumber.Equals(other.PartNumber) ) && ( Upcs == other.Upcs || Upcs != null && other.Upcs != null && Upcs.SequenceEqual(other.Upcs) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) ) && ( Brand == other.Brand || Brand != null && Brand.Equals(other.Brand) ) && ( Manufacturer == other.Manufacturer || Manufacturer != null && Manufacturer.Equals(other.Manufacturer) ) && ( Color == other.Color || Color != null && Color.Equals(other.Color) ) && ( NewPrice == other.NewPrice || NewPrice.Equals(other.NewPrice) ) && ( UsedPrice == other.UsedPrice || UsedPrice.Equals(other.UsedPrice) ) && ( CurrencyCode == other.CurrencyCode || CurrencyCode != null && CurrencyCode.Equals(other.CurrencyCode) ) && ( Url == other.Url || Url != null && Url.Equals(other.Url) ) && ( Features == other.Features || Features != null && other.Features != null && Features.SequenceEqual(other.Features) ) && ( Dimensions == other.Dimensions || Dimensions != null && other.Dimensions != null && Dimensions.SequenceEqual(other.Dimensions) ) && ( Images == other.Images || Images != null && other.Images != null && Images.SequenceEqual(other.Images) ) && ( MatchedItems == other.MatchedItems || MatchedItems != null && other.MatchedItems != null && MatchedItems.SequenceEqual(other.MatchedItems) ) && ( IsoCountryCodes == other.IsoCountryCodes || IsoCountryCodes != null && other.IsoCountryCodes != null && IsoCountryCodes.SequenceEqual(other.IsoCountryCodes) ) && ( CompanyName == other.CompanyName || CompanyName != null && CompanyName.Equals(other.CompanyName) ) && ( CompanyAddress == other.CompanyAddress || CompanyAddress != null && CompanyAddress.Equals(other.CompanyAddress) ) && ( Categories == other.Categories || Categories != null && other.Categories != null && Categories.SequenceEqual(other.Categories) ) && ( CategoryHierarchies == other.CategoryHierarchies || CategoryHierarchies != null && other.CategoryHierarchies != null && CategoryHierarchies.SequenceEqual(other.CategoryHierarchies) )); }