/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { int hashCode = CouponCode.GetHashCode(); hashCode = (hashCode * 397) ^ DiscountId; 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 (CouponCode != null) { hashCode = hashCode * 59 + CouponCode.GetHashCode(); } if (TotalDiscountAmount != null) { hashCode = hashCode * 59 + TotalDiscountAmount.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { return(CouponCode?.GetHashCode() ?? 0); }
public override int GetHashCode() { return(CouponCode.GetHashCode()); }