ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipartBuilderEx Class / RemovePart Method
The index of the part to remove. Must be less than PartCount. Specify -1 or (PartCount - 1) to remove the last part.
Example

In This Topic
    RemovePart Method
    In This Topic
    Remove the part specified by partIndex.
    Syntax
    Public Sub RemovePart( _
       ByVal partIndex As Integer _
    ) 
    public void RemovePart( 
       int partIndex
    )

    Parameters

    partIndex
    The index of the part to remove. Must be less than PartCount. Specify -1 or (PartCount - 1) to remove the last part.
    Exceptions
    ExceptionDescription
    partIndex is greater than PartCount - 1.
    Example
    Build a multi-part Polyline
    {
      List<MapPoint> firstPoints = new List<MapPoint>();
      firstPoints.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0));
      firstPoints.Add(MapPointBuilderEx.CreateMapPoint(1.0, 2.0));
      firstPoints.Add(MapPointBuilderEx.CreateMapPoint(2.0, 2.0));
      firstPoints.Add(MapPointBuilderEx.CreateMapPoint(2.0, 1.0));
    
      List<MapPoint> nextPoints = new List<MapPoint>();
      nextPoints.Add(MapPointBuilderEx.CreateMapPoint(11.0, 1.0));
      nextPoints.Add(MapPointBuilderEx.CreateMapPoint(11.0, 2.0));
      nextPoints.Add(MapPointBuilderEx.CreateMapPoint(12.0, 2.0));
      nextPoints.Add(MapPointBuilderEx.CreateMapPoint(12.0, 1.0));
    
      // use AttributeFlags.None since we have 2D points in the list
      PolylineBuilderEx pBuilder = new PolylineBuilderEx(firstPoints, AttributeFlags.None);
      pBuilder.AddPart(nextPoints);
    
      Polyline polylineFromBuilder = pBuilder.ToGeometry();
      // polyline has 2 parts
    
      pBuilder.RemovePart(0);
      polylineFromBuilder = pBuilder.ToGeometry();
      // polyline has 1 part
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also