ArcGIS Pro 2.7 API Reference Guide
CreatePolygon(Envelope,SpatialReference) Method
Example 

ArcGIS.Core.Geometry Namespace > PolygonBuilder Class > CreatePolygon Method : CreatePolygon(Envelope,SpatialReference) Method
The envelope to create the polygon. Note that if the envelope has z-values, they will be interpolated for the upper right and lower left vertices.
(Optional) The SpatialReference. The default value is null. If spatialReference is null, then the spatial reference will be inherited from envelope.
Convenience method to create a new instance of the Polygon class.
Syntax
public static Polygon CreatePolygon( 
   Envelope envelope,
   SpatialReference spatialReference
)
Public Overloads Shared Function CreatePolygon( _
   ByVal envelope As Envelope, _
   Optional ByVal spatialReference As SpatialReference _
) As Polygon

Parameters

envelope
The envelope to create the polygon. Note that if the envelope has z-values, they will be interpolated for the upper right and lower left vertices.
spatialReference
(Optional) The SpatialReference. The default value is null. If spatialReference is null, then the spatial reference will be inherited from envelope.

Return Value

Exceptions
ExceptionDescription
envelope is null.
Example
// Use a builder convenience method or use a builder constructor.

MapPoint minPt = MapPointBuilder.CreateMapPoint(1.0, 1.0);
MapPoint maxPt = MapPointBuilder.CreateMapPoint(2.0, 2.0);

// Create an envelope
Envelope env = EnvelopeBuilder.CreateEnvelope(minPt, maxPt);

// Builder convenience methods don't need to run on the MCT.
Polygon polygonFromEnv = PolygonBuilder.CreatePolygon(env);

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

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

PolygonBuilder Class
PolygonBuilder Members
Overload List