ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipartBuilderEx Class / AddPart Method / AddPart(IEnumerable<MapPoint>) Method
An enumeration of points.
Example

In This Topic
    AddPart(IEnumerable<MapPoint>) Method
    In This Topic
    Adds a part constructed by creating line segments from the enumeration of points. The part will be added to the end of the Parts list.
    Syntax
    public void AddPart( 
       IEnumerable<MapPoint> points
    )
    Public Overloads Sub AddPart( _
       ByVal points As IEnumerable(Of MapPoint) _
    ) 

    Parameters

    points
    An enumeration of points.
    Exceptions
    ExceptionDescription
    points is null.
    Remarks
    The spatial reference of each point is ignored. The attribute of each point does not affect the attribute awareness of the builder. However, if the builder has an attribute and a point also has that attribute, then the attribute value will be taken from the point. If the point doesn't have that attribute, then a default value will be set in the builder. For example, suppose the HasZ property of the builder is set to true. If the HasZ property of a point is set to true, then the point's Z-value is used. Otherwise, the default value is used. The default value for Z is 0, for M is NaN and for ID is 0.
    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 polyline = pBuilder.ToGeometry();
    // polyline has 2 parts
    
    pBuilder.RemovePart(0);
    polyline = pBuilder.ToGeometry();
    // polyline has 1 part
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also