ArcGIS Pro 2.7 API Reference Guide
CreatePolygon(IEnumerable<Coordinate2D>,SpatialReference) Method
Example 

ArcGIS.Core.Geometry Namespace > PolygonBuilder Class > CreatePolygon Method : CreatePolygon(IEnumerable<Coordinate2D>,SpatialReference) Method
Coordinates to create the polygon.
(Optional) The SpatialReference. The default value is null.
Convenience method to create a new instance of the Polygon class.
Syntax
Public Overloads Shared Function CreatePolygon( _
   ByVal coordinates As IEnumerable(Of Coordinate2D), _
   Optional ByVal spatialReference As SpatialReference _
) As Polygon

Parameters

coordinates
Coordinates to create the polygon.
spatialReference
(Optional) The SpatialReference. The default value is null.

Return Value

Exceptions
ExceptionDescription
coordinates is null.
Example
// clip a polyline by a polygon

List<Coordinate2D> list = new List<Coordinate2D>();
list.Add(new Coordinate2D(1.0, 1.0));
list.Add(new Coordinate2D(1.0, 4.0));
list.Add(new Coordinate2D(4.0, 4.0));
list.Add(new Coordinate2D(4.0, 1.0));

Polygon polygon = PolygonBuilder.CreatePolygon(list, SpatialReferences.WGS84);

LineSegment crossingLine = LineBuilder.CreateLineSegment(MapPointBuilder.CreateMapPoint(0, 3), MapPointBuilder.CreateMapPoint(5.0, 3.0));
Polyline p = PolylineBuilder.CreatePolyline(crossingLine);
Geometry geometry = GeometryEngine.Instance.Clip(p, polygon.Extent);
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

PolygonBuilder Class
PolygonBuilder Members
Overload List