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

            return
                ((
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                     ) &&
                 (
                     Tmax == other.Tmax ||
                     Tmax != null &&
                     Tmax.Equals(other.Tmax)
                 ) &&
                 (
                     Tmin == other.Tmin ||
                     Tmin != null &&
                     Tmin.Equals(other.Tmin)
                 ) &&
                 (
                     Rainfall == other.Rainfall ||
                     Rainfall != null &&
                     Rainfall.Equals(other.Rainfall)
                 ) &&
                 (
                     Wmean == other.Wmean ||
                     Wmean != null &&
                     Wmean.Equals(other.Wmean)
                 ) &&
                 (
                     Wmax == other.Wmax ||
                     Wmax != null &&
                     Wmax.Equals(other.Wmax)
                 ) &&
                 (
                     Insolation == other.Insolation ||
                     Insolation != null &&
                     Insolation.Equals(other.Insolation)
                 ) &&
                 (
                     Sunshine == other.Sunshine ||
                     Sunshine != null &&
                     Sunshine.Equals(other.Sunshine)
                 ));
        }
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 (Date != null)
         {
             hashCode = hashCode * 59 + Date.GetHashCode();
         }
         if (Tmax != null)
         {
             hashCode = hashCode * 59 + Tmax.GetHashCode();
         }
         if (Tmin != null)
         {
             hashCode = hashCode * 59 + Tmin.GetHashCode();
         }
         if (Rainfall != null)
         {
             hashCode = hashCode * 59 + Rainfall.GetHashCode();
         }
         if (Wmean != null)
         {
             hashCode = hashCode * 59 + Wmean.GetHashCode();
         }
         if (Wmax != null)
         {
             hashCode = hashCode * 59 + Wmax.GetHashCode();
         }
         if (Insolation != null)
         {
             hashCode = hashCode * 59 + Insolation.GetHashCode();
         }
         if (Sunshine != null)
         {
             hashCode = hashCode * 59 + Sunshine.GetHashCode();
         }
         return(hashCode);
     }
 }