ArcGIS Pro 2.7 API Reference Guide
Difference Method (GeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > GeometryEngine Class : Difference Method
the Geometry instance on the left hand side of the subtraction.
the Geometry on the right hand side being subtracted.
Performs the topological difference operation on the two geometries.
Syntax
public Geometry Difference( 
   Geometry geometry1,
   Geometry geometry2
)
Public Function Difference( _
   ByVal geometry1 As Geometry, _
   ByVal geometry2 As Geometry _
) As Geometry

Parameters

geometry1
the Geometry instance on the left hand side of the subtraction.
geometry2
the Geometry on the right hand side being subtracted.

Return Value

Returns the result of subtraction. The result has the dimension of geometry1.
Exceptions
ExceptionDescription
Either geometry1 or geometry2 or both are null or empty.
The method is not implemented for GeometryBag.
Incompatible spatial references between the input geometries.
Remarks

GeometryEngine Difference

Example
List<MapPoint> polyPts = new List<MapPoint>();
polyPts.Add(MapPointBuilder.CreateMapPoint(3.0, 2.0));
polyPts.Add(MapPointBuilder.CreateMapPoint(3.0, 6.0));
polyPts.Add(MapPointBuilder.CreateMapPoint(6.0, 6.0));
polyPts.Add(MapPointBuilder.CreateMapPoint(6.0, 2.0));

Polygon poly1 = PolygonBuilder.CreatePolygon(polyPts);

Envelope env = EnvelopeBuilder.CreateEnvelope(MapPointBuilder.CreateMapPoint(1.0, 1.0), MapPointBuilder.CreateMapPoint(4, 4));
Polygon poly2 = PolygonBuilder.CreatePolygon(env);

Geometry result = GeometryEngine.Instance.Difference(poly1, poly2);
Polygon polyResult = result as Polygon;
// polyResult.Area = 10.0

result = GeometryEngine.Instance.Difference(poly2, poly1);
polyResult = result as Polygon;
// polyResult.Area = 7.0
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

GeometryEngine Class
GeometryEngine Members