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 (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (HasDatePicker != null)
         {
             hashCode = hashCode * 59 + HasDatePicker.GetHashCode();
         }
         if (HasTimePicker != null)
         {
             hashCode = hashCode * 59 + HasTimePicker.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Returns true if Duration instances are equal
        /// </summary>
        /// <param name="other">Instance of Duration to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Duration 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)
                 ) &&
                 (
                     HasDatePicker == other.HasDatePicker ||
                     HasDatePicker != null &&
                     HasDatePicker.Equals(other.HasDatePicker)
                 ) &&
                 (
                     HasTimePicker == other.HasTimePicker ||
                     HasTimePicker != null &&
                     HasTimePicker.Equals(other.HasTimePicker)
                 ));
        }