Bendrinti naudojant


Xamarin.Essentials: Unit Converters

The UnitConverters class provides several unit converters to help developers when using Xamarin.Essentials.

Get started

To start using this API, read the getting started guide for Xamarin.Essentials to ensure the library is properly installed and set up in your projects.

Using Unit Converters

Add a reference to Xamarin.Essentials in your class:

using Xamarin.Essentials;

All unit converters are available by using the static UnitConverters class in Xamarin.Essentials. For instance you can easily convert Fahrenheit to Celsius.

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

API

Find more Xamarin videos on Channel 9 and YouTube.