Repository navigation
Getting Started
Marcus Ackre Medina edited this page Sep 13, 2026
·
2 revisions
dotnet add package MarcusMedina.Units.PressureTargets net10.0 (C# 14.0).
using MarcusMedina.Units.Pressure.Metric;
using MarcusMedina.Units.Pressure.US;
using MarcusMedina.Units.Pressure.Scientific;
// Create a Pressure from any supported unit
Pressure tire = 32.Psi();
Pressure storm = 980.Hectopascals();
// Convert to whatever unit you need
double bar = tire.ToBar(); // ≈ 2.21
double atmospheres = storm.ToAtm(); // ≈ 0.967
// Arithmetic works directly on Pressure values
Pressure total = tire + 1.Bar();
// Comparisons
bool higher = tire > storm;Pressure is a readonly struct that always stores its value internally as pascals. Every unit family — metric (Pa through GPa, plus bar/millibar/microbar), scientific/meteorological (atm, torr, mmHg, cmH₂O, inHg, inH₂O), and US customary (psi, psf, ksi) — is just a pair of extension methods: one that creates a Pressure by converting a raw number into pascals, and one (To...()) that converts back out. Because every Pressure shares the same internal representation, you can mix a US tire-pressure reading with a European weather-report hectopascal value in the same expression without ever risking a unit mismatch.
- API Overview for the full list of unit extension methods and conversion factors
- Advanced Usage for operators, comparisons, and formatting