This project has moved and is read-only. For the latest updates, please go here.

Anyone interested in units for C#?

Apr 9, 2014 at 10:28 AM
I often find that I want units, have written some stuff that I can make a pull request of if anyone is interested.
Apr 9, 2014 at 11:12 AM
With units you're referring to F# Units of Measure or something in this direction?
Apr 9, 2014 at 11:19 AM
Edited Apr 9, 2014 at 3:37 PM
Yeah, very similar but for C# (nothing fancy).

var a1 = new Angle(90, AngleUnit.Degrees);
var a2 = new Angle(Math.PI, AngleUnit.Radians);
var sum = a1 + a2;
Assert.AreEqual(270, sum.DegreesValue, 1E-6);
var l1 = new Length(1, LengthUnit.Meters);
var l2 = new Length(1, LengthUnit.MilliMeters);
var l3 = new Length(1, LengthUnit.Meters);
Volume volume = l1 * l2 * l3;
Length length = volume / (l2 * l3);