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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Marcus Ackre Medina edited this page Sep 13, 2026
·
2 revisions
Getting Started
Installation
dotnet add package MarcusMedina.Units.Area
Targets net10.0 (C# 14.0).
Your first conversion
usingMarcusMedina.Units.Area.Metric;usingMarcusMedina.Units.Area.SwedishOld;// Create an Area from any supported unitArearoom=24.5.SquareMeters();Areaplot=4.Tunnland();// Convert to whatever unit you needdoublehectares=plot.ToHectares();// ≈ 1.975doublekappland=plot.ToKappland();// 128// Arithmetic works directly on Area valuesAreatotal=room+1.Ares();// Comparisonsboolbigger=plot>room;
The core idea
Area is a readonly struct that always stores its value internally as square meters. Every unit family (metric, US, British, historical Swedish) is just an extension method that creates an Area by converting into square meters, and a matching To...() extension that converts back out. Because every Area shares the same internal representation, you can freely mix units in the same expression — 24.5.SquareMeters() + 1.Ares() — without ever risking a unit mismatch bug.
Next steps
API Overview for the full list of unit extension methods and conversion factors
Advanced Usage for operators, comparisons, and formatting