ESRI.ArcGIS.Mobile
Unit Class
Members  Example  See Also  Send Feedback
ESRI.ArcGIS.Mobile.SpatialReferences Namespace : Unit Class

Represents the unit of measurement for the current spatial reference.

Syntax

Visual Basic (Declaration) 
Public NotInheritable Class Unit 
C# 
public sealed class Unit 

Example

An example showing how to use the unit class to output a measurement in the specified units.
C#Copy Code
     
//gets the current sketch geometry and cast to polyline 
Polyline pl =  sketchGraphicLayer1.Geometry as Polyline; 
//Use the unit class to convert to meters 
Unit myunit = map1.SpatialReference.Unit; 
myunittest = Unit.GetUnit(myunit.FactoryCode); 
Unit targetunit = Unit.GetUnit(Unit.Meter.FactoryCode); 
double measure = Unit.FromUnitToUnit(pl.GetLength(), myunit, targetunit); 
// this will display measurements in a messagebox 
MessageBox.Show(measure.ToString()+ " " + targetunit.UnitName + "s");

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.Mobile.SpatialReferences.Unit

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.