ArcGIS Pro 2.8 API Reference Guide
ToGeometry() Method
Example 

ArcGIS.Core.Geometry Namespace > EnvelopeBuilder Class : ToGeometry() Method
Returns an Envelope instance representing the current state of the builder. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public override Envelope ToGeometry()
Public Overrides NotOverridable Function ToGeometry() As Envelope

Return Value

Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
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);

// Builder convenience methods don't need to run on the MCT.
Envelope envelope = EnvelopeBuilder.CreateEnvelope(minPt, maxPt);

// Builder constructors need to run on the MCT.
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  using (EnvelopeBuilder builder = new EnvelopeBuilder(minPt, maxPt))
  {
    // do something with the builder

    envelope = builder.ToGeometry();
  }
});

// builderEx constructors don't need to run on the MCT.
EnvelopeBuilderEx builderEx = new EnvelopeBuilderEx(minPt, maxPt);
envelope = builderEx.ToGeometry() as Envelope;

// builderEx convenience methods don't need to run on the MCT
envelope = EnvelopeBuilderEx.CreateEnvelope(minPt, maxPt);
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

EnvelopeBuilder Class
EnvelopeBuilder Members