ESRI.ArcGIS.ADF.IMS
RemoveAt Method
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace > LayerCollection Class : RemoveAt Method




index
The index of the layer to remove.
Removes a layer at a specified index in the collection.

Syntax

Visual Basic (Declaration) 
Public Sub RemoveAt( _
   ByVal index As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As LayerCollection
Dim index As Integer
 
instance.RemoveAt(index)
C# 
public void RemoveAt( 
   int index
)

Parameters

index
The index of the layer to remove.

Example

The following example removes the first (bottom) layer from the map. The code assumes an existing MapView object.
C#Copy Code
// Get the layer collection from a MapView 

ESRI.ArcGIS.ADF.IMS.Carto.Layer.LayerCollection mapLayers = mapView.Layers; 

  

// Remove the first (bottom) layer from the map 

mapLayers.RemoveAt(0); 

    
Visual BasicCopy Code
' Get the layer collection from a MapView

Dim mapLayers As ESRI.ArcGIS.ADF.IMS.Carto.Layer.LayerCollection _

    = mapView.Layers



' Remove the first (bottom) layer from the map

mapLayers.RemoveAt(0)

Remarks

This method removes a layer completely from the layer collection of the MapView orDataFrame. Both dynamic and static layers may be removed. After removal, the layer is not recoverable in the current MapView, unless a reference is maintained to the deleted layer and it is re-added (or unless a new MapView is generated from the MapService).

See Also

© 2010 All Rights Reserved.