ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / CompositeLayer Class / FindLayers Method
Name of the layer
(optional) When true the search continues in group layers. (default value = true)
Example

In This Topic
    FindLayers Method (CompositeLayer)
    In This Topic
    Finds layers by name.
    Syntax
    Public Overridable Function FindLayers( _
       ByVal name As String, _
       Optional ByVal recursive As Boolean _
    ) As IReadOnlyList(Of Layer)
    public virtual IReadOnlyList<Layer> FindLayers( 
       string name,
       bool recursive
    )

    Parameters

    name
    Name of the layer
    recursive
    (optional) When true the search continues in group layers. (default value = true)

    Return Value

    Example
    Enumerate the Discipline Layers from a Building SceneLayer
    {
      var bldgLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<BuildingSceneLayer>().First();
      var disciplines = new Dictionary<string, BuildingDisciplineSceneLayer>();
      //A Building layer has two children - Overview and FullModel
      //Overview is a FeatureSceneLayer
      //Full Model is a BuildingDisciplineSceneLayer that contains the disciplines
    
      var fullModel = bldgLayer.FindLayers("Full Model").First()
                                     as BuildingDisciplineSceneLayer;
    
      //collect information on the disciplines
      var name = fullModel.Name;
    
      var discipline = fullModel.GetDiscipline();
      //etc
      //TODO - use collected information
    
      disciplines.Add(discipline, fullModel);
    
      //Discipline layers are composite layers too
      foreach (var childDiscipline in fullModel.Layers
                          .OfType<BuildingDisciplineSceneLayer>())
      {
        //Discipline layers can also contain FeatureSceneLayers that render the
        //individual full model contents
        var content_names = string.Join(", ", childDiscipline.Layers
             .OfType<FeatureSceneLayer>().Select(fl => fl.Name));
        // Recursively call this "function" to go deeper
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also