The layers in the map of the type specified in the uid. If recursive is true it will return layers in group layers.
[Visual Basic 6.0] Property Layers(
[ByVal uid As IUID], _
[ByVal recursive As Boolean] _
) As IEnumLayer
[Visual Basic .NET] Public Function get_Layers ( _ [ByVal uid As UID], _ [ByVal recursive As Boolean] _ ) As IEnumLayer
[C#] public IEnumLayer get_Layers ( UID uid, bool recursive );
Optional Values
[Java] public getLayers ( IUID uid, boolean recursive, IEnumLayer Layers )
[C++] HRESULT get_Layers( IUID* uid, VARIANT_BOOL recursive, IEnumLayer** Layers );
Parameters
uid [in, optional, defaultvalue(0)]
uid is a parameter of type IUID
recursive [in, optional, defaultvalue(VARIANT_TRUE)]
recursive is a parameter of type VARIANT_BOOL
Layers [out, retval]
Layers is a parameter of type IEnumLayer
UID specifies the interface identifier (GUID) that represents the type of layer you want returned.
recursive Use True to also return the layers inside group layers.
See the sample code associated with the FeatureSelection property for an example of use.
Sub GetFeatureLayers()
Dim pMxDocument As IMxDocument
Dim pMap As IMap
Dim pEnumLayer As IEnumLayer
Dim pLayer As ILayer
Dim pId As New UID
Set pMxDocument = Application.Document
Set pMap = pMxDocument.FocusMap
pId = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}"
Set pEnumLayer = pMap.Layers(pId, True)
pEnumLayer.Reset
Set pLayer = pEnumLayer.Next
Do While Not pLayer Is Nothing
MsgBox pLayer.Name
Set pLayer = pEnumLayer.Next
Loop
End Sub