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

            return
                ((
                     EmploymentStatus == other.EmploymentStatus ||
                     EmploymentStatus != null &&
                     EmploymentStatus.Equals(other.EmploymentStatus)
                     ) &&
                 (
                     EmployeeType == other.EmployeeType ||
                     EmployeeType != null &&
                     EmployeeType.Equals(other.EmployeeType)
                 ) &&
                 (
                     HireDetails == other.HireDetails ||
                     HireDetails != null &&
                     HireDetails.Equals(other.HireDetails)
                 ) &&
                 (
                     DateJoinedNHS == other.DateJoinedNHS ||
                     DateJoinedNHS != null &&
                     DateJoinedNHS.Equals(other.DateJoinedNHS)
                 ) &&
                 (
                     AlAccrualPlan == other.AlAccrualPlan ||
                     AlAccrualPlan != null &&
                     AlAccrualPlan.Equals(other.AlAccrualPlan)
                 ) &&
                 (
                     PrevEmployer == other.PrevEmployer ||
                     PrevEmployer != null &&
                     PrevEmployer.Equals(other.PrevEmployer)
                 ) &&
                 (
                     Agencies == other.Agencies ||
                     Agencies != null &&
                     Agencies.Equals(other.Agencies)
                 ));
        }
コード例 #2
0
 /// <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 :)
         if (EmploymentStatus != null)
         {
             hashCode = hashCode * 59 + EmploymentStatus.GetHashCode();
         }
         if (EmployeeType != null)
         {
             hashCode = hashCode * 59 + EmployeeType.GetHashCode();
         }
         if (HireDetails != null)
         {
             hashCode = hashCode * 59 + HireDetails.GetHashCode();
         }
         if (DateJoinedNHS != null)
         {
             hashCode = hashCode * 59 + DateJoinedNHS.GetHashCode();
         }
         if (AlAccrualPlan != null)
         {
             hashCode = hashCode * 59 + AlAccrualPlan.GetHashCode();
         }
         if (PrevEmployer != null)
         {
             hashCode = hashCode * 59 + PrevEmployer.GetHashCode();
         }
         if (Agencies != null)
         {
             hashCode = hashCode * 59 + Agencies.GetHashCode();
         }
         return(hashCode);
     }
 }