ArcGIS Pro 2.8 API Reference Guide
Boundary Method (IGeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface : Boundary Method
Specifies the input geometry.
Calculates the boundary of the input geometry.
Syntax
Geometry Boundary( 
   Geometry geometry
)
Function Boundary( _
   ByVal geometry As Geometry _
) As Geometry

Parameters

geometry
Specifies the input geometry.

Return Value

The geometry that represents the boundary of the input geometry. For Point - returns an empty point. For Multipoint - returns an empty point. For Envelope - returns a polyline, that bounds the envelope. For Polyline - returns a multipoint, using OGC specification (includes path endpoints, using mod 2 rule). For Polygon - returns a polyline that bounds the polygon by adding all rings of the polygon to a polyline.
Exceptions
ExceptionDescription
Geometry is null or empty.
The method is not implemented for GeometryBag.
Remarks

GeometryEngine Boundary

Example
// create a donut polygon.  Must use the PolygonBuilder object

List<Coordinate2D> outerPts = new List<Coordinate2D>();
outerPts.Add(new Coordinate2D(10.0, 10.0));
outerPts.Add(new Coordinate2D(10.0, 20.0));
outerPts.Add(new Coordinate2D(20.0, 20.0));
outerPts.Add(new Coordinate2D(20.0, 10.0));

List<Coordinate2D> innerPts = new List<Coordinate2D>();
innerPts.Add(new Coordinate2D(13.0, 13.0));
innerPts.Add(new Coordinate2D(17.0, 13.0));
innerPts.Add(new Coordinate2D(17.0, 17.0));
innerPts.Add(new Coordinate2D(13.0, 17.0));

Polygon donut = null;

// Builder constructors need to run on the MCT.
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  // add the outer points
  using (PolygonBuilder pb = new PolygonBuilder(outerPts))
  {
    // add the inner points (note they are defined anticlockwise)
    pb.AddPart(innerPts);
    // get the polygon
    donut = pb.ToGeometry();
  }
});

// get the boundary 
Geometry g = GeometryEngine.Instance.Boundary(donut);
Polyline boundary = g as Polyline;
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members