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

            return
                ((
                     LicensePlate == other.LicensePlate ||
                     LicensePlate != null &&
                     LicensePlate.Equals(other.LicensePlate)
                     ) &&
                 (
                     Engine == other.Engine ||
                     Engine != null &&
                     Engine.Equals(other.Engine)
                 ) &&
                 (
                     Body == other.Body ||
                     Body != null &&
                     Body.Equals(other.Body)
                 ) &&
                 (
                     LowVoltage == other.LowVoltage ||
                     LowVoltage != null &&
                     LowVoltage.Equals(other.LowVoltage)
                 ) &&
                 (
                     Lighting == other.Lighting ||
                     Lighting != null &&
                     Lighting.Equals(other.Lighting)
                 ) &&
                 (
                     Brakes == other.Brakes ||
                     Brakes != null &&
                     Brakes.Equals(other.Brakes)
                 ) &&
                 (
                     Sensors == other.Sensors ||
                     Sensors != null &&
                     Sensors.Equals(other.Sensors)
                 ) &&
                 (
                     Miscellaneous == other.Miscellaneous ||
                     Miscellaneous != null &&
                     Miscellaneous.SequenceEqual(other.Miscellaneous)
                 ) &&
                 (
                     Conditioning == other.Conditioning ||
                     Conditioning != null &&
                     Conditioning.Equals(other.Conditioning)
                 ));
        }
Ejemplo 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 (LicensePlate != null)
         {
             hashCode = hashCode * 59 + LicensePlate.GetHashCode();
         }
         if (Engine != null)
         {
             hashCode = hashCode * 59 + Engine.GetHashCode();
         }
         if (Body != null)
         {
             hashCode = hashCode * 59 + Body.GetHashCode();
         }
         if (LowVoltage != null)
         {
             hashCode = hashCode * 59 + LowVoltage.GetHashCode();
         }
         if (Lighting != null)
         {
             hashCode = hashCode * 59 + Lighting.GetHashCode();
         }
         if (Brakes != null)
         {
             hashCode = hashCode * 59 + Brakes.GetHashCode();
         }
         if (Sensors != null)
         {
             hashCode = hashCode * 59 + Sensors.GetHashCode();
         }
         if (Miscellaneous != null)
         {
             hashCode = hashCode * 59 + Miscellaneous.GetHashCode();
         }
         if (Conditioning != null)
         {
             hashCode = hashCode * 59 + Conditioning.GetHashCode();
         }
         return(hashCode);
     }
 }