Пример #1
0
        /// <summary>
        /// Returns true if Note instances are equal
        /// </summary>
        /// <param name="other">Instance of Note to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Note other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Importance == other.Importance ||
                     Importance != null &&
                     Importance.Equals(other.Importance)
                 ) &&
                 (
                     CreatedDate == other.CreatedDate ||
                     CreatedDate != null &&
                     CreatedDate.Equals(other.CreatedDate)
                 ) &&
                 (
                     DueDate == other.DueDate ||
                     DueDate != null &&
                     DueDate.Equals(other.DueDate)
                 ) &&
                 (
                     FinishedDate == other.FinishedDate ||
                     FinishedDate != null &&
                     FinishedDate.Equals(other.FinishedDate)
                 ) &&
                 (
                     Finished == other.Finished ||
                     Finished != null &&
                     Finished.Equals(other.Finished)
                 ));
        }
Пример #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 (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Importance != null)
         {
             hashCode = hashCode * 59 + Importance.GetHashCode();
         }
         if (CreatedDate != null)
         {
             hashCode = hashCode * 59 + CreatedDate.GetHashCode();
         }
         if (DueDate != null)
         {
             hashCode = hashCode * 59 + DueDate.GetHashCode();
         }
         if (FinishedDate != null)
         {
             hashCode = hashCode * 59 + FinishedDate.GetHashCode();
         }
         if (Finished != null)
         {
             hashCode = hashCode * 59 + Finished.GetHashCode();
         }
         return(hashCode);
     }
 }