ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / Merge Method / Merge(Layer,Layer,IEnumerable<Int64>,Inspector) Method
The destination layer for the new feature.
The source layer of the features to merge.
The oids of the features to merge.
An inspector that specifies the new feature attributes.
Example

In This Topic
    Merge(Layer,Layer,IEnumerable<Int64>,Inspector) Method
    In This Topic
    Merge features into a new feature in a layer with attributes.
    Syntax
    Public Overloads Sub Merge( _
       ByVal destinationLayer As Layer, _
       ByVal sourceLayer As Layer, _
       ByVal sourceOIDs As IEnumerable(Of Long), _
       Optional ByVal inspector As Inspector _
    ) 

    Parameters

    destinationLayer
    The destination layer for the new feature.
    sourceLayer
    The source layer of the features to merge.
    sourceOIDs
    The oids of the features to merge.
    inspector
    An inspector that specifies the new feature attributes.
    Exceptions
    ExceptionDescription
    destinationLayer, sourceLayer, sourceOIDs cannot be null. List of ObjectIDs cannot be empty
    Example
    Edit Operation Merge Features
    var mergeFeatures = new EditOperation();
    mergeFeatures.Name = "Merge Features";
    
    //Merge three features into a new feature using defaults
    //defined in the current template
    //At 2.x -
    //mergeFeatures.Merge(this.CurrentTemplate as EditingFeatureTemplate, featureLayer, new List<long>() { 10, 96, 12 });
    mergeFeatures.Merge(this.CurrentTemplate as EditingRowTemplate, featureLayer, new List<long>() { 10, 96, 12 });
    
    //Merge three features into a new feature in the destination layer
    mergeFeatures.Merge(destinationLayer, featureLayer, new List<long>() { 10, 96, 12 });
    
    //Use an inspector to set the new attributes of the merged feature
    var inspector = new Inspector();
    inspector.Load(featureLayer, oid);//base attributes on an existing feature
    //change attributes for the new feature
    inspector["NAME"] = "New name";
    inspector["DESCRIPTION"] = "New description";
    
    //Merge features into a new feature in the same layer using the
    //defaults set in the inspector
    mergeFeatures.Merge(featureLayer, new List<long>() { 10, 96, 12 }, inspector);
    
    //Execute to execute the operation
    //Must be called within QueuedTask.Run
    if (!mergeFeatures.IsEmpty)
    {
      var result = mergeFeatures.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not
    }
    
    //or use async flavor
    //await mergeFeatures.ExecuteAsync();
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also