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


IMapLayerInfo2.ID Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IM > IMapLayerInfo2 Interface > IMapLayerInfo2.ID Property
ArcGIS Developer Help

IMapLayerInfo2.ID Property

The layer identifier. This ID is used throughout to uniquely identify the layer for all requests.

[Visual Basic .NET]
Public ReadOnly Property ID As Integer
[C#]
public int ID {get;}
[C++]
HRESULT get_ID(
  System.Int32* LayerID
);
[C++]
Parameters
LayerID [out, retval]

LayerID is a parameter of type long*

Product Availability

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

Remarks

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 a 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

IMapLayerInfo2 Interface