Beispiel #1
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 (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Code != null)
         {
             hashCode = hashCode * 59 + Code.GetHashCode();
         }
         if (CheckDigit != null)
         {
             hashCode = hashCode * 59 + CheckDigit.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (RelatedBranch != null)
         {
             hashCode = hashCode * 59 + RelatedBranch.GetHashCode();
         }
         if (OpeningDate != null)
         {
             hashCode = hashCode * 59 + OpeningDate.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Returns true if BranchIdentification instances are equal
        /// </summary>
        /// <param name="other">Instance of BranchIdentification to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BranchIdentification other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Code == other.Code ||
                     Code != null &&
                     Code.Equals(other.Code)
                 ) &&
                 (
                     CheckDigit == other.CheckDigit ||
                     CheckDigit != null &&
                     CheckDigit.Equals(other.CheckDigit)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     RelatedBranch == other.RelatedBranch ||
                     RelatedBranch != null &&
                     RelatedBranch.Equals(other.RelatedBranch)
                 ) &&
                 (
                     OpeningDate == other.OpeningDate ||
                     OpeningDate != null &&
                     OpeningDate.Equals(other.OpeningDate)
                 ));
        }