コード例 #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
            {
                int hash = 41;

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

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

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

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

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

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

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

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

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

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

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

                return(hash);
            }
        }
コード例 #2
0
        /// <summary>
        /// Returns true if EquipmentViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of EquipmentViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(EquipmentViewModel other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     EquipmentType == other.EquipmentType ||
                     EquipmentType != null &&
                     EquipmentType.Equals(other.EquipmentType)
                 ) &&
                 (
                     OwnerName == other.OwnerName ||
                     OwnerName != null &&
                     OwnerName.Equals(other.OwnerName)
                 ) &&
                 (
                     OwnerId == other.OwnerId ||
                     OwnerId != null &&
                     OwnerId.Equals(other.OwnerId)
                 ) &&
                 (
                     IsHired == other.IsHired ||
                     IsHired.Equals(other.IsHired)
                 ) &&
                 (
                     SeniorityString == other.SeniorityString ||
                     SeniorityString != null &&
                     SeniorityString.Equals(other.SeniorityString)
                 ) &&
                 (
                     Make == other.Make ||
                     Make != null &&
                     Make.Equals(other.Make)
                 ) &&
                 (
                     Model == other.Model ||
                     Model != null &&
                     Model.Equals(other.Model)
                 ) &&
                 (
                     Size == other.Size ||
                     Size != null &&
                     Size.Equals(other.Size)
                 ) &&
                 (
                     EquipmentCode == other.EquipmentCode ||
                     EquipmentCode != null &&
                     EquipmentCode.Equals(other.EquipmentCode)
                 ) &&
                 (
                     AttachmentCount == other.AttachmentCount ||
                     AttachmentCount.Equals(other.AttachmentCount)
                 ) &&
                 (
                     LastVerifiedDate == other.LastVerifiedDate ||
                     LastVerifiedDate != null &&
                     LastVerifiedDate.Equals(other.LastVerifiedDate)
                 ) &&
                 (
                     SenioritySortOrder == other.SenioritySortOrder ||
                     SenioritySortOrder.Equals(other.SenioritySortOrder)
                 ));
        }