ArcObjects Library Reference (Carto)  

IMapDocument.Layer Property

The Layer object at the specified index for the specified map.

[Visual Basic .NET]
Public Function get_Layer ( _
    ByVal mapIndex As Integer, _
    ByVal layerIndex As Integer _
) As ILayer
[C#]
public ILayer get_Layer (
    int mapIndex,
    int layerIndex
);
[C++]
HRESULT get_Layer(
  long mapIndex,
  long layerIndex,
  ILayer** ppLayer
);
[C++]

Parameters

mapIndex [in]   mapIndex is a parameter of type long layerIndex [in]   layerIndex is a parameter of type long ppLayer [out, retval]

  ppLayer is a parameter of type ILayer

Product Availability

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

Description

Returns the Layer at the specified index of the specified Map's layer collection.

Use a zero-based index to specify a Map in the PageLayout map collection. For example, to get the first Map in the map collection, pass an index of 0, and to get the last Map in the map collection, pass an index of (MapCount - 1).

Use a zero-based index to specify a Layer in the Map layer collection. For example, to get the first Layer in the layer collection, pass an index of 0, and to get the last Layer in the layer collection, pass an index of (IMap::LayerCount - 1).

If a Layer File (*.lyr) is Open specify a mapIndex of 0, and a layerIndex of 0 to return the layer.

See Also

IMapDocument Interface

.NET Related Topics

How to add display caching