コード例 #1
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);
            }
        }