/// <summary> /// Returns true if CarClass instances are equal /// </summary> /// <param name="other">Instance of CarClass to be compared</param> /// <returns>Boolean</returns> public bool Equals(CarClass other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( IdCarClass == other.IdCarClass || IdCarClass.Equals(other.IdCarClass) ) && ( _CarClass == other._CarClass || _CarClass != null && _CarClass.Equals(other._CarClass) ) && ( Fee == other.Fee || Fee.Equals(other.Fee) )); }
/// <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 + IdCarClass.GetHashCode(); if (_CarClass != null) { hashCode = hashCode * 59 + _CarClass.GetHashCode(); } hashCode = hashCode * 59 + Fee.GetHashCode(); return(hashCode); } }