ArcGIS Pro 2.8 API Reference Guide
CreateLayer(CIMDataConnection,ILayerContainerEdit,Int32,String) Method

ArcGIS.Desktop.Mapping Namespace > LayerFactory Class > CreateLayer Method : CreateLayer(CIMDataConnection,ILayerContainerEdit,Int32,String) Method
A CIMDataConnection
A map or group layer instance to which the Layer will be added
The position of the layer in the map or group layer. 0 represents the top most position.
(optional) When it is not provided, the default display name gets used e.g. the dataset name or alias. (default value = "")
Overloaded. Create a new Layer instance using a CIMDefinition and adds that to a container such as a map or group layer. Optionally you can provide a name to override the default display name. This method must be called on the MCT. Use QueuedTask.Run
Syntax
Public Overloads Function CreateLayer( _
   ByVal dataConnection As CIMDataConnection, _
   ByVal mapOrGroupLayer As ILayerContainerEdit, _
   ByVal index As Integer, _
   Optional ByVal layerName As String _
) As Layer

Parameters

dataConnection
A CIMDataConnection
mapOrGroupLayer
A map or group layer instance to which the Layer will be added
index
The position of the layer in the map or group layer. 0 represents the top most position.
layerName
(optional) When it is not provided, the default display name gets used e.g. the dataset name or alias. (default value = "")

Return Value

Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

LayerFactory Class
LayerFactory Members
Overload List