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 (Number != null)
         {
             hashCode = hashCode * 59 + Number.GetHashCode();
         }
         if (Country != null)
         {
             hashCode = hashCode * 59 + Country.GetHashCode();
         }
         if (IssuingOffice != null)
         {
             hashCode = hashCode * 59 + IssuingOffice.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Entries != null)
         {
             hashCode = hashCode * 59 + Entries.GetHashCode();
         }
         if (Validity != null)
         {
             hashCode = hashCode * 59 + Validity.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Returns true if Visa instances are equal
        /// </summary>
        /// <param name="other">Instance of Visa to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Visa other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Number == other.Number ||
                     Number != null &&
                     Number.Equals(other.Number)
                     ) &&
                 (
                     Country == other.Country ||
                     Country != null &&
                     Country.Equals(other.Country)
                 ) &&
                 (
                     IssuingOffice == other.IssuingOffice ||
                     IssuingOffice != null &&
                     IssuingOffice.Equals(other.IssuingOffice)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     Entries == other.Entries ||
                     Entries != null &&
                     Entries.Equals(other.Entries)
                 ) &&
                 (
                     Validity == other.Validity ||
                     Validity != null &&
                     Validity.Equals(other.Validity)
                 ));
        }