ArcGIS Pro 2.9 API Reference Guide
FromEsriShape Method (EnvelopeBuilder)
Example 

ArcGIS.Core.Geometry Namespace > EnvelopeBuilder Class : FromEsriShape Method
Esri shape buffer representation of Envelope. Note that the buffer will actually represent a Polygon because there is not an Esri shape buffer representation of an envelope.
(Optional)The spatial reference of the Envelope.
Creates a new instance of a Envelope class from an Esri shape buffer.
Syntax
public new static Envelope FromEsriShape( 
   byte[] esriShapeBuffer,
   SpatialReference spatialReference
)
Public Shared Shadows Function FromEsriShape( _
   ByVal esriShapeBuffer() As Byte, _
   Optional ByVal spatialReference As SpatialReference _
) As Envelope

Parameters

esriShapeBuffer
Esri shape buffer representation of Envelope. Note that the buffer will actually represent a Polygon because there is not an Esri shape buffer representation of an envelope.
spatialReference
(Optional)The spatial reference of the Envelope.

Return Value

Exceptions
ExceptionDescription
The esriShapeBuffer is empty or null.
Esri shape buffer is invalid or does not represent an polygon.
Example
// create an envelope
List<MapPoint> coordsZM = new List<MapPoint>
{
  MapPointBuilder.CreateMapPoint(1001, 1002, 1003, 1004),
  MapPointBuilder.CreateMapPoint(2001, 2002, Double.NaN, 2004),
  MapPointBuilder.CreateMapPoint(3001, -3002, 3003, 3004),
  MapPointBuilder.CreateMapPoint(1001, -4002, 4003, 4004)
};

Envelope envelope = EnvelopeBuilder.CreateEnvelope(coordsZM[0], coordsZM[2], SpatialReferences.WGS84);

// export and import
EsriShapeExportFlags exportFlags = EsriShapeExportFlags.esriShapeExportDefaults;
EsriShapeImportFlags importFlags = EsriShapeImportFlags.esriShapeImportDefaults;
byte[] buffer = GeometryEngine.Instance.ExportToEsriShape(exportFlags, envelope);
Polygon importedPolygon = GeometryEngine.Instance.ImportFromEsriShape(importFlags, buffer, envelope.SpatialReference) as Polygon;
Envelope importedEnvelope = importedPolygon.Extent;

// export without z,m
buffer = GeometryEngine.Instance.ExportToEsriShape(EsriShapeExportFlags.esriShapeExportStripZs | EsriShapeExportFlags.esriShapeExportStripMs, envelope);
importedPolygon = GeometryEngine.Instance.ImportFromEsriShape(importFlags, buffer, SpatialReferences.WGS84) as Polygon;
importedEnvelope = importedPolygon.Extent;

bool hasZ = importedEnvelope.HasZ;      // hasZ = false
bool hasM = importedEnvelope.HasM;      // hasM = false

// export with shapeSize
int bufferSize = GeometryEngine.Instance.GetEsriShapeSize(exportFlags, envelope);
buffer = new byte[bufferSize];

bufferSize = GeometryEngine.Instance.ExportToEsriShape(exportFlags, envelope, ref buffer);
importedPolygon = GeometryEngine.Instance.ImportFromEsriShape(importFlags, buffer, envelope.SpatialReference) as Polygon;
importedEnvelope = importedPolygon.Extent;


// or use the envelope and envelopeBuilder classes
buffer = envelope.ToEsriShape();
// buffer represents a polygon as there is not an envelope Esri shape buffer
// EnvelopeBuilder.FromEsriShape takes a polygon Esri shape buffer and returns the extent of the polygon.
importedEnvelope = EnvelopeBuilder.FromEsriShape(buffer);
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

EnvelopeBuilder Class
EnvelopeBuilder Members