Esempio n. 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 (Ean != null)
         {
             hashCode = hashCode * 59 + Ean.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Streams != null)
         {
             hashCode = hashCode * 59 + Streams.GetHashCode();
         }
         if (LevelSubjects != null)
         {
             hashCode = hashCode * 59 + LevelSubjects.GetHashCode();
         }
         if (Models != null)
         {
             hashCode = hashCode * 59 + Models.GetHashCode();
         }
         if (TrialAccessUrl != null)
         {
             hashCode = hashCode * 59 + TrialAccessUrl.GetHashCode();
         }
         if (DefaultAccessUrl != null)
         {
             hashCode = hashCode * 59 + DefaultAccessUrl.GetHashCode();
         }
         if (ShortDescription != null)
         {
             hashCode = hashCode * 59 + ShortDescription.GetHashCode();
         }
         if (LongDescription != null)
         {
             hashCode = hashCode * 59 + LongDescription.GetHashCode();
         }
         if (Media != null)
         {
             hashCode = hashCode * 59 + Media.GetHashCode();
         }
         if (RelatedProducts != null)
         {
             hashCode = hashCode * 59 + RelatedProducts.GetHashCode();
         }
         if (BundledProducts != null)
         {
             hashCode = hashCode * 59 + BundledProducts.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Returns true if Product instances are equal
        /// </summary>
        /// <param name="other">Instance of Product to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Product other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Ean == other.Ean ||
                     Ean != null &&
                     Ean.Equals(other.Ean)
                     ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Streams == other.Streams ||
                     Streams != null &&
                     Streams.SequenceEqual(other.Streams)
                 ) &&
                 (
                     LevelSubjects == other.LevelSubjects ||
                     LevelSubjects != null &&
                     LevelSubjects.SequenceEqual(other.LevelSubjects)
                 ) &&
                 (
                     Models == other.Models ||
                     Models != null &&
                     Models.SequenceEqual(other.Models)
                 ) &&
                 (
                     TrialAccessUrl == other.TrialAccessUrl ||
                     TrialAccessUrl != null &&
                     TrialAccessUrl.Equals(other.TrialAccessUrl)
                 ) &&
                 (
                     DefaultAccessUrl == other.DefaultAccessUrl ||
                     DefaultAccessUrl != null &&
                     DefaultAccessUrl.Equals(other.DefaultAccessUrl)
                 ) &&
                 (
                     ShortDescription == other.ShortDescription ||
                     ShortDescription != null &&
                     ShortDescription.Equals(other.ShortDescription)
                 ) &&
                 (
                     LongDescription == other.LongDescription ||
                     LongDescription != null &&
                     LongDescription.Equals(other.LongDescription)
                 ) &&
                 (
                     Media == other.Media ||
                     Media != null &&
                     Media.Equals(other.Media)
                 ) &&
                 (
                     RelatedProducts == other.RelatedProducts ||
                     RelatedProducts != null &&
                     RelatedProducts.SequenceEqual(other.RelatedProducts)
                 ) &&
                 (
                     BundledProducts == other.BundledProducts ||
                     BundledProducts != null &&
                     BundledProducts.SequenceEqual(other.BundledProducts)
                 ));
        }