public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (Class == null ? 0 : Class.GetHashCode()); hash = hash * 23 + (Color == null ? 0 : Color.GetHashCode()); hash = hash * 23 + (DaysToManufacture == default(int) ? 0 : DaysToManufacture.GetHashCode()); hash = hash * 23 + (DiscontinuedDate == null ? 0 : DiscontinuedDate.GetHashCode()); hash = hash * 23 + (FinishedGoodsFlag == default(bool) ? 0 : FinishedGoodsFlag.GetHashCode()); hash = hash * 23 + (ListPrice == default(decimal) ? 0 : ListPrice.GetHashCode()); hash = hash * 23 + (MakeFlag == default(bool) ? 0 : MakeFlag.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (Name == null ? 0 : Name.GetHashCode()); hash = hash * 23 + (ProductLine == null ? 0 : ProductLine.GetHashCode()); hash = hash * 23 + (ProductModelId == null ? 0 : ProductModelId.GetHashCode()); hash = hash * 23 + (ProductNumber == null ? 0 : ProductNumber.GetHashCode()); hash = hash * 23 + (ProductSubcategoryId == null ? 0 : ProductSubcategoryId.GetHashCode()); hash = hash * 23 + (ReorderPoint == default(short) ? 0 : ReorderPoint.GetHashCode()); hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode()); hash = hash * 23 + (SafetyStockLevel == default(short) ? 0 : SafetyStockLevel.GetHashCode()); hash = hash * 23 + (SellEndDate == null ? 0 : SellEndDate.GetHashCode()); hash = hash * 23 + (SellStartDate == default(DateTime) ? 0 : SellStartDate.GetHashCode()); hash = hash * 23 + (Size == null ? 0 : Size.GetHashCode()); hash = hash * 23 + (SizeUnitMeasureCode == null ? 0 : SizeUnitMeasureCode.GetHashCode()); hash = hash * 23 + (StandardCost == default(decimal) ? 0 : StandardCost.GetHashCode()); hash = hash * 23 + (Style == null ? 0 : Style.GetHashCode()); hash = hash * 23 + (Weight == null ? 0 : Weight.GetHashCode()); hash = hash * 23 + (WeightUnitMeasureCode == null ? 0 : WeightUnitMeasureCode.GetHashCode()); return(hash); } }
/// <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 (ProductId != null) { hashCode = hashCode * 59 + ProductId.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (ProductNumber != null) { hashCode = hashCode * 59 + ProductNumber.GetHashCode(); } if (Color != null) { hashCode = hashCode * 59 + Color.GetHashCode(); } if (StandardCost != null) { hashCode = hashCode * 59 + StandardCost.GetHashCode(); } if (ListPrice != null) { hashCode = hashCode * 59 + ListPrice.GetHashCode(); } if (Size != null) { hashCode = hashCode * 59 + Size.GetHashCode(); } if (Weight != null) { hashCode = hashCode * 59 + Weight.GetHashCode(); } if (ProductLine != null) { hashCode = hashCode * 59 + ProductLine.GetHashCode(); } if (Class != null) { hashCode = hashCode * 59 + Class.GetHashCode(); } if (Style != null) { hashCode = hashCode * 59 + Style.GetHashCode(); } if (SubCategory != null) { hashCode = hashCode * 59 + SubCategory.GetHashCode(); } if (Model != null) { hashCode = hashCode * 59 + Model.GetHashCode(); } if (Photo != null) { hashCode = hashCode * 59 + Photo.GetHashCode(); } if (Review != null) { hashCode = hashCode * 59 + Review.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Product instances are equal /// </summary> /// <param name="other">Instance of Product to be compared</param> /// <returns>Boolean</returns> public bool Equals(Product other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ProductId == other.ProductId || ProductId != null && ProductId.Equals(other.ProductId) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( ProductNumber == other.ProductNumber || ProductNumber != null && ProductNumber.Equals(other.ProductNumber) ) && ( Color == other.Color || Color != null && Color.Equals(other.Color) ) && ( StandardCost == other.StandardCost || StandardCost != null && StandardCost.Equals(other.StandardCost) ) && ( ListPrice == other.ListPrice || ListPrice != null && ListPrice.Equals(other.ListPrice) ) && ( Size == other.Size || Size != null && Size.Equals(other.Size) ) && ( Weight == other.Weight || Weight != null && Weight.Equals(other.Weight) ) && ( ProductLine == other.ProductLine || ProductLine != null && ProductLine.Equals(other.ProductLine) ) && ( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( Style == other.Style || Style != null && Style.Equals(other.Style) ) && ( SubCategory == other.SubCategory || SubCategory != null && SubCategory.Equals(other.SubCategory) ) && ( Model == other.Model || Model != null && Model.Equals(other.Model) ) && ( Photo == other.Photo || Photo != null && Photo.Equals(other.Photo) ) && ( Review == other.Review || Review != null && Review.SequenceEqual(other.Review) )); }