ArcGIS Pro 2.8 API Reference Guide
PolygonBuilder Constructor(IEnumerable<MapPoint>)
Example 

ArcGIS.Core.Geometry Namespace > PolygonBuilder Class > PolygonBuilder Constructor : PolygonBuilder Constructor(IEnumerable<MapPoint>)
Points for the first ring.
Initializes a new instance of the PolygonBuilder class. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public PolygonBuilder( 
   IEnumerable<MapPoint> points
)
Public Function New( _
   ByVal points As IEnumerable(Of MapPoint) _
)

Parameters

points
Points for the first ring.
Exceptions
ExceptionDescription
Incompatible spatial references.
This method or property must be called within the lambda passed to QueuedTask.Run.
points is null.
Example
// Use a builder convenience method or use a builder constructor.

MapPoint pt1 = MapPointBuilder.CreateMapPoint(1.0, 1.0);
MapPoint pt2 = MapPointBuilder.CreateMapPoint(1.0, 2.0);
MapPoint pt3 = MapPointBuilder.CreateMapPoint(2.0, 2.0);
MapPoint pt4 = MapPointBuilder.CreateMapPoint(2.0, 1.0);

List<MapPoint> list = new List<MapPoint>() { pt1, pt2, pt3, pt4 };

// Builder convenience methods don't need to run on the MCT.
Polygon polygon = PolygonBuilder.CreatePolygon(list, SpatialReferences.WGS84);

// Builder constructors need to run on the MCT.
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  using (PolygonBuilder polygonBuilder = new PolygonBuilder(list))
  {
    polygonBuilder.SpatialReference = SpatialReferences.WGS84;
    polygon = polygonBuilder.ToGeometry();
  }
});


// builderEx constructor's don't need to run on the MCT
PolygonBuilderEx polygonBuilderEx = new PolygonBuilderEx(list);
polygonBuilderEx.SpatialReference = SpatialReferences.WGS84;
polygon = polygonBuilderEx.ToGeometry() as Polygon;

// builderEx convenience methods don't need to run on the MCT
//     use AttributeFlags.NoAttributes because we only have 2d points in the list
polygon = PolygonBuilderEx.CreatePolygon(list, AttributeFlags.NoAttributes);
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

PolygonBuilder Class
PolygonBuilder Members
Overload List