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

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

Parameters

segments
Segments 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 segments.

Return Value

Exceptions
ExceptionDescription
Incompatible spatial references.
segments is null.
Example
List<Segment> segmentList = new List<Segment>(30);
ICollection<Segment> collection = segmentList;
polygon.GetAllSegments(ref collection);
// segmentList.Count = 4
// segmentList.Capacity = 30

// use the segments to build another polygon
Polygon polygonFromSegments = PolygonBuilder.CreatePolygon(collection);
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

PolygonBuilder Class
PolygonBuilder Members
Overload List