ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ILayerFactory Interface / CreateLayers Method / CreateLayers(IEnumerable<Uri>,ILayerContainerEdit,Int32) Method
The set of URIs that represent the path to a set of datasets.
A map or group layer where the Layers will be added.
The position of the first Layer in the map or group layer. 0 represents the top most position.

In This Topic
    CreateLayers(IEnumerable<Uri>,ILayerContainerEdit,Int32) Method
    In This Topic
    Creates a readonly list of new Layer instances for each of the specified dataset paths and adds them to a container such as a map. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    dataUris
    The set of URIs that represent the path to a set of datasets.
    container
    A map or group layer where the Layers will be added.
    index
    The position of the first Layer in the map or group layer. 0 represents the top most position.

    Return Value

    A Readonly list of Layer.
    Remarks
    The bulk layer creation process creates the layers it is able to per the data supplied. If invalid Uris, data connections or Items exist amongst valid data, there will be a mismatch in the number of layers created compared to the number of data items supplied. For example, 5 Uris are supplied, but only 4 layers are created because one of the Uris points to a dataset that does not exist. LayerFactory.CreateLayers will return the layers created, but no information regarding the invalid dataset. The only exception to this is if all datasets are invalid (and no layers are created); in this scenario an System.ArgumentException will be thrown.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also