Esempio n. 1
0
        /// <summary>
        /// Returns true if BookForCreationWithAmountOfPages instances are equal
        /// </summary>
        /// <param name="other">Instance of BookForCreationWithAmountOfPages to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BookForCreationWithAmountOfPages other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AmountOfPages == other.AmountOfPages ||
                     AmountOfPages != null &&
                     AmountOfPages.Equals(other.AmountOfPages)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ));
        }
Esempio n. 2
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 (AmountOfPages != null)
         {
             hashCode = hashCode * 59 + AmountOfPages.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         return(hashCode);
     }
 }