Skip to content

Getting Started

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

using MarcusMedina.Units.Area.Metric;
using MarcusMedina.Units.Area.SwedishOld;

// Create an Area from any supported unit
Area room = 24.5.SquareMeters();
Area plot = 4.Tunnland();

// Convert to whatever unit you need
double hectares = plot.ToHectares();       // ≈ 1.975
double kappland  = plot.ToKappland();      // 128

// Arithmetic works directly on Area values
Area total = room + 1.Ares();

// Comparisons
bool bigger = 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

Clone this wiki locally