ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Core.UnitFormats Namespace / DisplayUnitFormat Class / FormatValue Method
The value to be formatted
Example

In This Topic
    FormatValue Method
    In This Topic
    Format the input value using the unit format. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public string FormatValue( 
       double value
    )
    Public Function FormatValue( _
       ByVal value As Double _
    ) As String

    Parameters

    value
    The value to be formatted

    Return Value

    The formatted value
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run
    Remarks
    For the unit format of type UnitFormatType.Location use FormatLocation(Double,Double,SpatialReference) or FormatLocation(MapPoint) with the location to be formatted.
    Example
    Format an Elevation Using the Current Map Elevation Unit
    var mv = MapView.Active;
    var map = mv.Map;
    
    QueuedTask.Run(() =>
    {
      //Get the current elevation unit. If the map is not
      //a scene the default Project distance unit is returned
      var elev_unit = map.GetElevationUnitFormat();
    
      //Format the view camera elevation
      var str = elev_unit.FormatValue(mv.Camera.Z);
    
      System.Diagnostics.Debug.WriteLine($"Formatted elevation: {str}");
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also