You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a.Equals(b) is the basic way to check if two elements are the same. But it is Obsolete!
For the case I want to use record, the equality is almost unusable.
/// <summary>Indicates strict equality of two <see cref="Length"/> quantities, where both <see cref="Value" /> and <see cref="Unit" /> are exactly equal.</summary>
[Obsolete("Use Equals(Length other, Length tolerance) instead, to check equality across units and to specify the max tolerance for rounding errors due to floating-point arithmetic when converting between units.")]
publicoverrideboolEquals(object?obj)
{
if(objisnull||!(objisLengthotherQuantity))
returnfalse;
returnEquals(otherQuantity);
}
/// <inheritdoc />
/// <summary>Indicates strict equality of two <see cref="Length"/> quantities, where both <see cref="Value" /> and <see cref="Unit" /> are exactly equal.</summary>
[Obsolete("Use Equals(Length other, Length tolerance) instead, to check equality across units and to specify the max tolerance for rounding errors due to floating-point arithmetic when converting between units.")]
I know this is a PIA, but defining a global tolerance constant might not be the safest option (there isn't really a way of coming up with reasonable defaults), especially when you consider the possibility of linking together different projects.
PS I keep saying this for months now, but I'm reeeally close to finishing my new proposal for v6 which, if accepted, should bring back the == operators (without any of the rounding issues we've had in the past).
a.Equals(b)
is the basic way to check if two elements are the same. But it isObsolete
!For the case I want to use
record
, the equality is almost unusable.UnitsNet/UnitsNet/GeneratedCode/Quantities/Length.g.cs
Lines 1217 to 1234 in b57ac63
Shall we add a static class like Global Tolerance Configurations to let it work like the
Equals
method withtolerance
? That would make things ez.UnitsNet/UnitsNet/GeneratedCode/Quantities/Length.g.cs
Lines 1337 to 1345 in b57ac63
So it should look like this.
The text was updated successfully, but these errors were encountered: