Bases and classes to support quantity, measurement, and unit conversion
$ dotnet add package InnerDrive.QuantitativeThe Inner Drive Extensible Architecture implements common .NET development situations including time zones, money, measurements and conversions, and Microsoft Azure features.
This package runs on .NET 10. It depends on the InnerDrive.Core package.
Converting between SI and English measurements is straightforward:
var kilos = 10d.Kilograms();
var pounds = kilos.ConvertTo(typeof(Pound));
Trace.WriteLine($"{kilos.ToString()} = {pounds.ToString("0.00"}");
Output >> 10 kg = 22.05 lbs.
var mph = 100d.MilesPerHour();
var kmh = mph.KilometersPerHour();
Trace.WriteLine($"{mph.ToString()} = {kmh.ToString("0.0")}");
Output >> 100 mph = 160.9 km/hr.
var stamfordBridge = (103d * 67d).SquareMeters();
var soldierField = (360 * 160d).SquareFeet();
var difference = stamfordBridge - soldierField;
Trace.WriteLine($"The football pitch at Stamford Bridge is {difference.ToString("0,0.0")} bigger than the football field at Soldier Field");
Output >> The football pitch at Stamford Bridge is 1,549.8 m² bigger than the football field at Soldier Field
The Inner Drive Technology website has a full SDK and example code. We also have a demo weather site that uses all the IDEA components.
Comments or questions? Send feedback