diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs index 578bc291a0..32064b0d62 100644 --- a/UnitsNet/BaseUnits.cs +++ b/UnitsNet/BaseUnits.cs @@ -46,14 +46,6 @@ public BaseUnits( Temperature = temperature; Amount = amount; LuminousIntensity = luminousIntensity; - - IsFullyDefined = Length is not null && - Mass is not null && - Time is not null && - Current is not null && - Temperature is not null && - Amount is not null && - LuminousIntensity is not null; } /// @@ -72,6 +64,9 @@ public bool Equals(BaseUnits? other) if (other is null) return false; + if (ReferenceEquals(this, other)) + return true; + return Length == other.Length && Mass == other.Mass && Time == other.Time && @@ -108,7 +103,11 @@ public bool IsSubsetOf(BaseUnits other) /// public override int GetHashCode() { +#if NET + return HashCode.Combine(Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity); +#else return new {Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}.GetHashCode(); +#endif } /// @@ -198,8 +197,19 @@ string GetDefaultAbbreviation(TUnitType? unitOrNull) where TUnitType public LuminousIntensityUnit? LuminousIntensity{ get; } /// - /// Gets whether or not all of the base units are defined. + /// Gets a value indicating whether all base units are defined. /// - public bool IsFullyDefined { get; } + /// + /// This property returns true if all seven base units + /// (Length, Mass, Time, Current, Temperature, Amount, and LuminousIntensity) + /// are non-null; otherwise, it returns false. + /// + public bool IsFullyDefined => Length is not null && + Mass is not null && + Time is not null && + Current is not null && + Temperature is not null && + Amount is not null && + LuminousIntensity is not null; } }