ArcGIS Pro 2.7 API Reference Guide
AddPart(IEnumerable<Coordinate2D>) Method
Example 

ArcGIS.Core.Geometry Namespace > MultipartBuilder<T> Class > AddPart Method : AddPart(IEnumerable<Coordinate2D>) Method
An enumeration of coordinates.
Adds a part constructed by creating line segments from the enumeration of coordinates. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public virtual void AddPart( 
   IEnumerable<Coordinate2D> coordinates
)
Public Overloads Overridable Sub AddPart( _
   ByVal coordinates As IEnumerable(Of Coordinate2D) _
) 

Parameters

coordinates
An enumeration of coordinates.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
coordinates is null.
Example
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));

// Builder constructors need to run on the MCT.
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  // use the PolygonBuilder as we wish to manipulate the parts
  using (PolygonBuilder pb = new PolygonBuilder(outerCoordinates))
  {
    Polygon donut = pb.ToGeometry();
    double area = donut.Area;       // area = 100

    // 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));

    pb.AddPart(innerCoordinates);
    donut = pb.ToGeometry();

    area = donut.Area;    // area = 84.0

    area = GeometryEngine.Instance.Area(donut);    // area = 84.0
  }
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MultipartBuilder<T> Class
MultipartBuilder<T> Members
Overload List