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

ILayerDescription.ID Property (ArcObjects .NET 10.7 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IL > ILayerDescription Interface > ILayerDescription.ID Property
ArcGIS Developer Help

ILayerDescription.ID Property

The layer ID. This is a unique ID for the layer, and is used to identify the layer in a number of method calls.

[Visual Basic .NET]
Public Property ID As Integer
public int ID {get; set;}
  System.Int32* LayerID
  long LayerID
LayerID [out, retval]

LayerID is a parameter of type long* LayerID [in]
LayerID is a parameter of type long

Product Availability

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


ID is a unique identifier for a layer in a given instance of ArcGIS for Server map service. It is important to note that ID, SourceID and the index of layers (see MapLayerInfos) in map document are not the same. SourceID is used for map service interaction with the GPServer.

When a map service is published, a unique ID is assigned to all layers within the original map document (.mxd) starting from 0 (zero). This ID is accessible from IMapServerObjects2, MapLayerInfo, LayerDescription, MapServerLegendInfo, MapServerIdentifyResult, MapServerFindResult and FeatureExtent.

ID is not re-usable and does not change if the order of the layer is changed. This would change the how each layer is ordered in the index of layers. Adding new a layer results in a new ID being assigned.  IDs keep incrementing as new layers are added to the map service. The limit of id numbers available is the limit of Long data type.

Please note that if the layer order in the TOC of the original map is changed or if layers are added/removed, the IDs will change accordingly.

See Also

ILayerDescription Interface