/// <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 :) hashCode = hashCode * 59 + ManufacturerId.GetHashCode(); if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (CountryCode != null) { hashCode = hashCode * 59 + CountryCode.GetHashCode(); } if (Address != null) { hashCode = hashCode * 59 + Address.GetHashCode(); } if (Website != null) { hashCode = hashCode * 59 + Website.GetHashCode(); } return(hashCode); } }
/// <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 (ManufacturerId != null) { hashCode = hashCode * 59 + ManufacturerId.GetHashCode(); } if (CategoryId != null) { hashCode = hashCode * 59 + CategoryId.GetHashCode(); } if (ProductName != null) { hashCode = hashCode * 59 + ProductName.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (BarCode != null ? BarCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Price.GetHashCode(); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsPublished.GetHashCode(); hashCode = (hashCode * 397) ^ (Dimensions != null ? Dimensions.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ManufacturerId.GetHashCode(); hashCode = (hashCode * 397) ^ (Pictures != null ? Pictures.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CategoryId.GetHashCode(); hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ProductTypeId; hashCode = (hashCode * 397) ^ (ProductType != null ? ProductType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ExternalSourceName != null ? ExternalSourceName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ExternalId != null ? ExternalId.GetHashCode() : 0); return(hashCode); } }
/// <summary> /// 获取 UID 哈希值 /// </summary> /// <returns></returns> public override int GetHashCode() { return(ManufacturerId.GetHashCode() + DeviceId.GetHashCode()); }