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

            return
                ((
                     MainThumbnailUrl == other.MainThumbnailUrl ||
                     MainThumbnailUrl != null &&
                     MainThumbnailUrl.Equals(other.MainThumbnailUrl)
                     ) &&
                 (
                     ProductImageUrls == other.ProductImageUrls ||
                     ProductImageUrls != null &&
                     ProductImageUrls.SequenceEqual(other.ProductImageUrls)
                 ) &&
                 (
                     ProductVideoUrls == other.ProductVideoUrls ||
                     ProductVideoUrls != null &&
                     ProductVideoUrls.SequenceEqual(other.ProductVideoUrls)
                 ) &&
                 (
                     ProductPdfUrls == other.ProductPdfUrls ||
                     ProductPdfUrls != null &&
                     ProductPdfUrls.SequenceEqual(other.ProductPdfUrls)
                 ));
        }