This document is archived and information here might be outdated.  Recommended version.


ISpatialReferenceFactory.CreateUnit Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IS > ISpatialReferenceFactory Interface > ISpatialReferenceFactory.CreateUnit Method
ArcGIS Developer Help

ISpatialReferenceFactory.CreateUnit Method

Creates a predefined unit of measure.

[Visual Basic .NET]
Public Function CreateUnit ( _
    ByVal unitType As Integer _
) As IUnit
[C#]
public IUnit CreateUnit (
    int unitType
);
[C++]
HRESULT CreateUnit(
  long unitType
);
[C++]
Parameters
unitType 

unitType is a parameter of type long

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Use an element from the esriSRUnitType or esriSRUnit2Type enumerations as the unitType to create a particular predefined unit of measure.

[C#]

ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
//Create the unit using the available units.  These can be
//found in the esriGeometry esriSRUnitType enumeration.
ILinearUnit linearUnit = spatialReferenceFactory.CreateUnit((int)esriSRUnitType.esriSRUnit_Foot) as ILinearUnit;

[Visual Basic .NET]

        Dim pSpatRefFact As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory
        'Set the spatial reference factory to a new spatial reference environment
        pSpatRefFact = New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment

        Dim pUnit As ESRI.ArcGIS.Geometry.ILinearUnit

        'Create the unit using the available units.  These can be
        'found in the esriGeometry esriSRUnitType enumeration.

        pUnit = pSpatRefFact.CreateUnit(ESRI.ArcGIS.Geometry.esriSRUnitType.esriSRUnit_Foot)

See Also

ISpatialReferenceFactory Interface | esriSRUnitType Constants | esriSRUnit2Type Constants

.NET Samples

Clonable object