Composite units

Peter Morlion edited this page May 13, 2016 · 2 revisions

RedStar.Amounts supports combining units to create new ones. An example of this is speed:

var maximumSpeed = new Amount(120, LengthUnits.KiloMeter / TimeUnits.Hour);

SpeedUnits are included in RedStar.Amounts however, so you could just do:

var maximumSpeed = new Amount(120, SpeedUnits.KilometerPerHour);

But not all your scenario's may be covered, so you can combine anything you like:

var flow = new Amount(3, VolumeUnits.Meter3 / TimeUnits.Second);

Or go totally crazy:

var something = new Amount(8, PressureUnits.Bar / VolumeUnits.Meter3 / TimeUnits.Hour);

If you're often using the same composite unit that isn't included by default in RedStar.Amounts, consider registering your own units.

You can’t perform that action at this time.
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.
Press h to open a hovercard with more details.