|
using System;
using StandardUnits;
using TypedUnits;
namespace SampleConsoleApplication
{
class Program
{
static void Main(string[] args)
{
// Just a sample case:
// ===================
// To allow using units by name, we'll register all units declared in the "StandardUnits" assembly:
UnitManager.RegisterByAssembly(typeof(StandardUnits.SIUnitTypes).Assembly);
// I'm driving in a car driving at 70 Miles per hour:
var carSpeed = new Amount(70.0, SpeedUnits.MilePerHour);
// I throw an apple forward through the window at 4 meter per second:
var relativeAppleSpeed = new Amount(4.0, "meter/second");
// So the absolute speed of the apple flowing through the air:
var absoluteAppleSpeed = carSpeed + relativeAppleSpeed;
// Display the result in km/h:
Console.WriteLine("Absolute speed of the apple: {0:#,##0.00 US|kilometer/hour}", absoluteAppleSpeed);
Console.WriteLine();
Console.WriteLine("Press ENTER to end.");
Console.ReadLine();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.