//============================================================================* // CompareBasics() //============================================================================* public int CompareBasics(cBallistics Ballistics) { if (Ballistics == null) { return(1); } int rc = BallisticCoefficient.CompareTo(Ballistics.BallisticCoefficient); if (rc == 0) { rc = BulletDiameter.CompareTo(Ballistics.BulletDiameter); if (rc == 0) { rc = BulletWeight.CompareTo(Ballistics.BulletWeight); if (rc == 0) { rc = BulletLength.CompareTo(Ballistics.BulletLength); if (rc == 0) { rc = MuzzleVelocity.CompareTo(Ballistics.MuzzleVelocity); } } } } return(rc); }
/// <summary> /// Returns hash code value /// </summary> /// <returns></returns> public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + TypeOfAmmunition.GetHashCode(); hash = hash * 23 + (CaliberGroup?.GetHashCode() ?? 0.GetHashCode()); hash = hash * 23 + BulletDiameter.GetHashCode(); hash = hash * 23 + Name.GetHashCode(); hash = hash * 23 + Name.GetHashCode(); foreach (var an in AlternativeNames) { hash = hash * 23 + an.GetHashCode(); } return(hash); } }