angularsen / UnitsNet

Makes life working with units of measurement just a little bit better.
https://www.nuget.org/packages/UnitsNet/
MIT No Attribution
2.65k stars 382 forks source link

Add operators for ReciprocalLength/-Area #1382

Closed trb5016 closed 7 months ago

trb5016 commented 7 months ago

Added additional operators that result in ReciprocalLength (Length/Area, Area/Volume) and ReciprocalArea (Length/Volume)

Muximize commented 7 months ago

In the upcoming v6, relational operators where removed from the *.extra.cs files in favor of generated operators (#1329).

If you like, you could make an additional PR targeting the release/v6 branch where you add the equivalent multiplication operators in UnitRelations.json:

"Area.SquareMeter = Volume.CubicMeter * ReciprocalLength.InverseMeter",
"Length.Meter = Area.SquareMeter * ReciprocalLength.InverseMeter",
"Length.Meter = Volume.CubicMeter * ReciprocalArea.InverseSquareMeter",

The division operators will then be inferred and generated too.

trb5016 commented 7 months ago

Cool. That will be some nice functionality, I haven't been following on the updates for a bit.

Made PR #1385 for release/v6 as suggested.

angularsen commented 7 months ago

Looks good, thanks!

angularsen commented 7 months ago

Release UnitsNet/5.50.0 · angularsen/UnitsNet