ArcGIS Pro 2.6 API Reference Guide
CreatePolygon(IEnumerable<MapPoint>,SpatialReference) Method
Example 

ArcGIS.Core.Geometry Namespace > PolygonBuilder Class > CreatePolygon Method : CreatePolygon(IEnumerable<MapPoint>,SpatialReference) Method
Points to create the polygon.
(Optional) The SpatialReference. The default value is null. If spatialReference is null, then the spatial reference will be inherited from points.
Convenience method to create a new instance of the Polygon class.
Syntax
Public Overloads Shared Function CreatePolygon( _
   ByVal points As IEnumerable(Of MapPoint), _
   Optional ByVal spatialReference As SpatialReference _
) As Polygon

Parameters

points
Points to create the polygon.
spatialReference
(Optional) The SpatialReference. The default value is null. If spatialReference is null, then the spatial reference will be inherited from points.

Return Value

Exceptions
ExceptionDescription
Incompatible spatial references.
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();
  }
});
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

PolygonBuilder Class
PolygonBuilder Members
Overload List