Unit converters

Browse sample. Browse the sample

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: