コード例 #1
0
        /// <summary>
        /// Returns true if VehicleType instances are equal
        /// </summary>
        /// <param name="input">Instance of VehicleType to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(VehicleType input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     TypeId == input.TypeId ||
                     (TypeId != null &&
                      TypeId.Equals(input.TypeId))
                     ) &&
                 (
                     Profile == input.Profile ||
                     (Profile != null &&
                      Profile.Equals(input.Profile))
                 ) &&
                 (
                     Capacity == input.Capacity ||
                     Capacity != null &&
                     Capacity.SequenceEqual(input.Capacity)
                 ) &&
                 (
                     SpeedFactor == input.SpeedFactor ||
                     (SpeedFactor != null &&
                      SpeedFactor.Equals(input.SpeedFactor))
                 ) &&
                 (
                     ServiceTimeFactor == input.ServiceTimeFactor ||
                     (ServiceTimeFactor != null &&
                      ServiceTimeFactor.Equals(input.ServiceTimeFactor))
                 ) &&
                 (
                     CostPerMeter == input.CostPerMeter ||
                     (CostPerMeter != null &&
                      CostPerMeter.Equals(input.CostPerMeter))
                 ) &&
                 (
                     CostPerSecond == input.CostPerSecond ||
                     (CostPerSecond != null &&
                      CostPerSecond.Equals(input.CostPerSecond))
                 ) &&
                 (
                     CostPerActivation == input.CostPerActivation ||
                     (CostPerActivation != null &&
                      CostPerActivation.Equals(input.CostPerActivation))
                 ));
        }
コード例 #2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (TypeId != null)
         {
             hashCode = hashCode * 59 + TypeId.GetHashCode();
         }
         if (Profile != null)
         {
             hashCode = hashCode * 59 + Profile.GetHashCode();
         }
         if (Capacity != null)
         {
             hashCode = hashCode * 59 + Capacity.GetHashCode();
         }
         if (SpeedFactor != null)
         {
             hashCode = hashCode * 59 + SpeedFactor.GetHashCode();
         }
         if (ServiceTimeFactor != null)
         {
             hashCode = hashCode * 59 + ServiceTimeFactor.GetHashCode();
         }
         if (CostPerMeter != null)
         {
             hashCode = hashCode * 59 + CostPerMeter.GetHashCode();
         }
         if (CostPerSecond != null)
         {
             hashCode = hashCode * 59 + CostPerSecond.GetHashCode();
         }
         if (CostPerActivation != null)
         {
             hashCode = hashCode * 59 + CostPerActivation.GetHashCode();
         }
         return(hashCode);
     }
 }