/// <summary> /// Compares equality between two conversion values. /// </summary> /// <param name="obj">Another conversion value to compare against.</param> /// <returns>The equality between two conversion values.</returns> public override bool Equals(object obj) { bool equalValues = false; if (obj.GetType() == typeof(ConversionValue)) { var otherValue = obj as ConversionValue; if (otherValue != null) { if (Type.Equals(otherValue.Type) && Value == otherValue.Value && UpperUnits.All(unit => unit?.Equals(otherValue.UpperUnits.ElementAt(UpperUnits.IndexOf(unit))) ?? true) && LowerUnits.All(unit => unit?.Equals(otherValue.LowerUnits.ElementAt(LowerUnits.IndexOf(unit))) ?? true)) { equalValues = true; } } } return(equalValues); }
/// <summary> /// Compares equality between two conversion values. /// </summary> /// <param name="otherValue">Another conversion value to compare against.</param> /// <returns>The equality between two conversion values.</returns> public bool Equals(ConversionValue otherValue) { bool equalValues = false; if (otherValue != null) { if (Type.Equals(otherValue.Type) && Value == otherValue.Value && UpperUnits.All(unit => unit?.Equals(otherValue.UpperUnits.ElementAt(UpperUnits.IndexOf(unit))) ?? true) && LowerUnits.All(unit => unit?.Equals(otherValue.LowerUnits.ElementAt(LowerUnits.IndexOf(unit))) ?? true)) { equalValues = true; } } return(equalValues); }