コード例 #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 (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (MappingSetId != null)
         {
             hashCode = hashCode * 59 + MappingSetId.GetHashCode();
         }
         if (From != null)
         {
             hashCode = hashCode * 59 + From.GetHashCode();
         }
         if (To != null)
         {
             hashCode = hashCode * 59 + To.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns true if Mapping instances are equal
        /// </summary>
        /// <param name="other">Instance of Mapping to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Mapping other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     MappingSetId == other.MappingSetId ||
                     MappingSetId != null &&
                     MappingSetId.Equals(other.MappingSetId)
                 ) &&
                 (
                     From == other.From ||
                     From != null &&
                     From.Equals(other.From)
                 ) &&
                 (
                     To == other.To ||
                     To != null &&
                     To.Equals(other.To)
                 ));
        }