Ejemplo n.º 1
0
        /// <summary>
        /// Returns true if Profile instances are equal
        /// </summary>
        /// <param name="other">Instance of Profile to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Profile other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Sens == other.Sens ||
                     Sens != null &&
                     Sens.Equals(other.Sens)
                     ) &&
                 (
                     Dia == other.Dia ||
                     Dia != null &&
                     Dia.Equals(other.Dia)
                 ) &&
                 (
                     Carbratio == other.Carbratio ||
                     Carbratio != null &&
                     Carbratio.Equals(other.Carbratio)
                 ) &&
                 (
                     CarbsHr == other.CarbsHr ||
                     CarbsHr != null &&
                     CarbsHr.Equals(other.CarbsHr)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Sens != null)
                {
                    hash = hash * 59 + Sens.GetHashCode();
                }

                if (Dia != null)
                {
                    hash = hash * 59 + Dia.GetHashCode();
                }

                if (Carbratio != null)
                {
                    hash = hash * 59 + Carbratio.GetHashCode();
                }

                if (CarbsHr != null)
                {
                    hash = hash * 59 + CarbsHr.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                return(hash);
            }
        }