ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core.UnitFormats Namespace / DisplayUnitFormat Class / UnitCode Property
Example

In This Topic
    UnitCode Property
    In This Topic
    Gets the factory code of the unit format
    Syntax
    Public ReadOnly Property UnitCode As Integer
    public int UnitCode {get;}
    Remarks
    Corresponds to the underlying unit of measure. Different DisplayUnitFormats can have the same underlying unit of measure.
    Example
    Get the Current Map Location Unit
    {
        //var map = MapView.Active.Map;
        //Note: Must be on the QueuedTask.Run()
    
        //Get the current location unit
        var loc_unit = map.GetLocationUnitFormat();
        var line = $"{loc_unit.DisplayName}, {loc_unit.UnitCode}";
        System.Diagnostics.Debug.WriteLine(line);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also