How to: Convert Between Metric Prefixes

The Unit Conversion API includes a special converter that helps you convert between different metric prefixes. The following code illustrates how to display a pressure that is equal to 760 millimeters of mercury in hectopascals.

Imports DevExpress.UnitConversion
Imports System.Diagnostics
            ' The pressure value is set to 760 mmHg.
            Dim pressure As QuantityValue(Of Pressure) = (760).MmHg()
            ' Since it is a quantity value, it should be transformed to a proper measurement unit
            ' to obtain a value for display or for comparison.
            ' The pressure is obtained in Pascals and then converted into hectoPascals.
            Dim prefixConverter As New MetricUnitsConverter()
            Dim pressure_in_hPa As Double = prefixConverter.Convert(pressure.ToPascals(), MetricPrefix.None, MetricPrefix.Hecto)
            Debug.WriteLine(pressure_in_hPa)