IMap.LayerCount Property (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Carto)  

IMap.LayerCount Property

Number of layers in the map.

[Visual Basic .NET]
Public ReadOnly Property LayerCount As Integer
public int LayerCount {get;}
HRESULT get_LayerCount(
  System.Int32* Count

Parameters Count [out, retval]
Count is a parameter of type long*

Product Availability

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




LayerCount returns the number of layers in the map that implement IDataLayer.

LayerCount does not include the basic graphics layer (CompositeGraphicLayer) that each map contains nor does it return the graphic layers that can be created into this composite layer.

See Also

IMap Interface | IDataLayer Interface

.NET Snippets

Get GeoFeatureLayer from Layer Index Number | Get Index Number from Layer Name | Get FeatureLayer from Layer Index Number | Zoom to Layer by Index Number

.NET Samples

Convert part to feature command (Code Files: ConvertPart) | Editing using a custom form (Code Files: EditorForm) | Dynamic cache layer manager controller (Code Files: CacheManagerDlg) | Graphics layers ToolControl (Code Files: GraphicsLayersListCtrl) | Buffer snap agent (Code Files: BufferSnap) | Custom selection extension (Code Files: SelectionExtension) | Create a custom selection extension by extending ArcObjects (Code Files: SelectionExtension ZoomToLayerMultiItem)

.NET Related Topics

Add-in coding patterns | How to create an edit session