Skip to content
Marcus Ackre Medina edited this page Jul 20, 2026 · 2 revisions

MarcusMedina.Units.Speed

Fluent speed unit conversion for .NET 10+ — metric, US customary, nautical, and scientific units, all built on a single strongly-typed Speed struct.

dotnet add package MarcusMedina.Units.Speed

Why this exists

This one comes with a very specific, very embarrassing memory attached. Back in upper-secondary school, working through a problem involving a truck's weight, speed, road surface, and wind resistance, I somehow — through some mysterious chain of unit errors — calculated that the truck was travelling at 5 times the speed of light. My teacher was not impressed. Years later, teaching my own students, I still had flashbacks to that lesson. So I finally sat down and coded speed conversions properly, if only to explain it to myself, decades late. I wanted each unit conversion broken into the same small, obvious steps — precisely the steps that would have stopped that truck from ever breaking causality.

Who this is for

  • New to C#? A clean example of a fluent, extension-method-based conversion API — 120.KilometersPerHour().ToMilesPerHour().
  • Need real conversions? Every unit is backed by an explicit, documented conversion factor against metres per second — no guessing which raw double means what.

Pages

Quick Example

using MarcusMedina.Units.Speed.Metric;
using MarcusMedina.Units.Speed.Nautical;
using MarcusMedina.Units.Speed.Scientific;

Speed car   = 120.KilometersPerHour();
Speed ship  = 15.Knots();
Speed jet   = 1.2.Mach();

double mph   = car.ToMilesPerHour();     // ≈ 74.6
double ms    = ship.ToMetersPerSecond(); // ≈ 7.72

Speed total = car + 10.KilometersPerHour();
bool faster = jet > car;

Links

Clone this wiki locally