コード例 #1
0
 /// <summary>
 ///   Определяет, равен ли заданный объект текущему объекту.
 /// </summary>
 /// <param name="obj">
 ///   Объект, который требуется сравнить с текущим объектом.
 /// </param>
 /// <returns>
 ///   Значение <see langword="true" />, если указанный объект равен текущему объекту; в противном случае — значение <see langword="false" />.
 /// </returns>
 public override bool Equals(object obj)
 {
     return(obj is AxisInfo other &&
            string.Equals(AxisNum, other?.AxisNum) &&
            AxisStinginess == other?.AxisStinginess &&
            string.Equals(SuspentionType, other?.SuspentionType) &&
            Distance2NextAxis == other?.Distance2NextAxis &&
            MeasuredAsisWeight.Equals(other?.MeasuredAsisWeight) &&
            LegalAxisWeight.Equals(other?.LegalAxisWeight) &&
            SpecialAllow.Equals(other?.SpecialAllow) &&
            UsedAxisAllow.Equals(other?.UsedAxisAllow) &&
            WeightRecordedExcess.Equals(other?.WeightRecordedExcess) &&
            PercentRecordedExcess.Equals(other?.PercentRecordedExcess) &&
            string.Equals(Overweight, other?.Overweight));
 }
コード例 #2
0
 /// <summary>Служит хэш-функцией по умолчанию.</summary>
 /// <returns>Хэш-код для текущего объекта.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (AxisNum != null ? AxisNum.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AxisStinginess;
         hashCode = (hashCode * 397) ^ (SuspentionType != null ? SuspentionType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Distance2NextAxis;
         hashCode = (hashCode * 397) ^ MeasuredAsisWeight.GetHashCode();
         hashCode = (hashCode * 397) ^ LegalAxisWeight.GetHashCode();
         hashCode = (hashCode * 397) ^ SpecialAllow.GetHashCode();
         hashCode = (hashCode * 397) ^ UsedAxisAllow.GetHashCode();
         hashCode = (hashCode * 397) ^ WeightRecordedExcess.GetHashCode();
         hashCode = (hashCode * 397) ^ PercentRecordedExcess.GetHashCode();
         hashCode = (hashCode * 397) ^ (Overweight != null ? Overweight.GetHashCode() : 0);
         return(hashCode);
     }
 }