ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipartBuilderEx Class / AddPart Method / AddPart(IEnumerable<Coordinate2D>) Method
An enumeration of coordinates.
Example

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

    Parameters

    coordinates
    An enumeration of coordinates.
    Exceptions
    ExceptionDescription
    coordinates is null.
    Example
    Build a donut polygon
    List<Coordinate2D> outerCoordinates = new List<Coordinate2D>();
    outerCoordinates.Add(new Coordinate2D(10.0, 10.0));
    outerCoordinates.Add(new Coordinate2D(10.0, 20.0));
    outerCoordinates.Add(new Coordinate2D(20.0, 20.0));
    outerCoordinates.Add(new Coordinate2D(20.0, 10.0));
    
    // define the inner polygon as anti-clockwise
    List<Coordinate2D> innerCoordinates = new List<Coordinate2D>();
    innerCoordinates.Add(new Coordinate2D(13.0, 13.0));
    innerCoordinates.Add(new Coordinate2D(17.0, 13.0));
    innerCoordinates.Add(new Coordinate2D(17.0, 17.0));
    innerCoordinates.Add(new Coordinate2D(13.0, 17.0));
    
    PolygonBuilderEx pbEx = new PolygonBuilderEx(outerCoordinates);
    Polygon donutEx = pbEx.ToGeometry() as Polygon;
    double areaEx = donutEx.Area;       // area = 100
    
    pbEx.AddPart(innerCoordinates);
    donutEx = pbEx.ToGeometry() as Polygon;
    
    areaEx = donutEx.Area;    // area = 84.0
    
    areaEx = GeometryEngine.Instance.Area(donutEx);    // area = 84.0
    
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also