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

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     IsDumpTruck == other.IsDumpTruck ||
                     IsDumpTruck.Equals(other.IsDumpTruck)
                 ) &&
                 (
                     BlueBookSection == other.BlueBookSection ||
                     BlueBookSection != null &&
                     BlueBookSection.Equals(other.BlueBookSection)
                 ) &&
                 (
                     NumberOfBlocks == other.NumberOfBlocks ||
                     NumberOfBlocks.Equals(other.NumberOfBlocks)
                 ) &&
                 (
                     BlueBookRateNumber == other.BlueBookRateNumber ||
                     BlueBookRateNumber != null &&
                     BlueBookRateNumber.Equals(other.BlueBookRateNumber)
                 ) &&
                 (
                     MaximumHours == other.MaximumHours ||
                     MaximumHours != null &&
                     MaximumHours.Equals(other.MaximumHours)
                 ) &&
                 (
                     ExtendHours == other.ExtendHours ||
                     ExtendHours != null &&
                     ExtendHours.Equals(other.ExtendHours)
                 ) &&
                 (
                     MaxHoursSub == other.MaxHoursSub ||
                     MaxHoursSub != null &&
                     MaxHoursSub.Equals(other.MaxHoursSub)
                 ));
        }
Example #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
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();

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

                hash = hash * 59 + IsDumpTruck.GetHashCode();

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

                hash = hash * 59 + NumberOfBlocks.GetHashCode();

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

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

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

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

                return(hash);
            }
        }