Beispiel #1
0
        public override bool Equals(object obj)
        {
            var dailyForecastObject = obj as DailyForecastModel;

            if (dailyForecastObject == null)
            {
                return(base.Equals(obj));
            }
            else
            {
                bool equalDetailedDailyForecasts = false;

                if (DetailedDailyForecasts.Count == dailyForecastObject.DetailedDailyForecasts.Count)
                {
                    for (int i = 0; i < DetailedDailyForecasts.Count; i++)
                    {
                        if (!DetailedDailyForecasts[i].Equals(dailyForecastObject.DetailedDailyForecasts[i]))
                        {
                            return(false);
                        }
                    }
                    equalDetailedDailyForecasts = true;
                }

                return(AvgWeatherConditions.Equals(dailyForecastObject.AvgWeatherConditions) &&
                       Date == dailyForecastObject.Date &&
                       equalDetailedDailyForecasts);
            }
        }
Beispiel #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + AvgWeatherConditions.GetHashCode();
         hash = hash * 23 + Date.GetHashCode();
         hash = hash * 23 + DetailedDailyForecasts.GetHashCode();
         return(hash);
     }
 }