Unit converters
This article describes how you can use the .NET Multi-platform App UI (.NET MAUI) UnitConverters class. This class provides several unit converters to help developers convert from one unit of measurement to another.
Using unit converters
All unit converters are available by using the static Microsoft.Maui.Media.UnitConverters
class. For example, you can convert Fahrenheit to Celsius with the FahrenheitToCelsius method:
var celsius = UnitConverters.FahrenheitToCelsius(32.0);
Here is a list of available conversions:
- FahrenheitToCelsius
- CelsiusToFahrenheit
- CelsiusToKelvin
- KelvinToCelsius
- MilesToMeters
- MilesToKilometers
- KilometersToMiles
- MetersToInternationalFeet
- InternationalFeetToMeters
- DegreesToRadians
- RadiansToDegrees
- DegreesPerSecondToRadiansPerSecond
- RadiansPerSecondToDegreesPerSecond
- DegreesPerSecondToHertz
- RadiansPerSecondToHertz
- HertzToDegreesPerSecond
- HertzToRadiansPerSecond
- KilopascalsToHectopascals
- HectopascalsToKilopascals
- KilopascalsToPascals
- HectopascalsToPascals
- AtmospheresToPascals
- PascalsToAtmospheres
- CoordinatesToMiles
- CoordinatesToKilometers
- KilogramsToPounds
- PoundsToKilograms
- StonesToPounds
- PoundsToStones
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.