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

IMap.ClearLayers Method (ArcObjects .NET 10.7 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IM > IMap Interface > IMap.ClearLayers Method
ArcGIS Developer Help

IMap.ClearLayers Method

Removes all layers from the map.

[Visual Basic .NET]
Public Sub ClearLayers ( _
public void ClearLayers (
HRESULT ClearLayers(

Product Availability

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


ClearLayers removes all layers types from the Map.  ClearLayers does not change or reset the Map's spatail reference however.  In addition, ClearLayers does not affect any graphics stored in the Map's BasicGaphicsLayer - it's not a true Layer.  ClearLayers does not update the contents view (TOC) or the display.

See Also

IMap Interface