Пример #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 (Brand != null)
         {
             hashCode = hashCode * 59 + Brand.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Horsepower != null)
         {
             hashCode = hashCode * 59 + Horsepower.GetHashCode();
         }
         if (Consumption != null)
         {
             hashCode = hashCode * 59 + Consumption.GetHashCode();
         }
         if (Priceperday != null)
         {
             hashCode = hashCode * 59 + Priceperday.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #2
0
        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 17;

                hash = (hash * 23) + Id.GetHashCode();
                hash = (hash * 23) + BrandName.GetHashCode();
                hash = (hash * 23) + Model.GetHashCode();
                hash = (hash * 23) + Horsepower.GetHashCode();
                hash = (hash * 23) + Generation.GetHashCode();
                hash = (hash * 23) + ProdutionDate.GetHashCode();
                hash = (hash * 23) + BrandId.GetHashCode();

                return(hash);
            }
        }