ArcGIS Pro 2.7 API Reference Guide
Union(Geometry,Geometry) Method
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface > Union Method : Union(Geometry,Geometry) Method
The first geometry to union with.
The second geometry to union with.
Constructs the set-theoretic union of the input geometries.
Syntax
Overloads Function Union( _
   ByVal geometry1 As Geometry, _
   ByVal geometry2 As Geometry _
) As Geometry

Parameters

geometry1
The first geometry to union with.
geometry2
The second geometry to union with.

Return Value

A geometry representing the union of the input geometries.
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.
Input geometries do not have the same dimension.
The operation cannot be performed on a non-simple geometry.
Spatial reference of geometry1or geometry2is an image coordinate system.
Remarks

GeometryEngine Union

Example
MapPoint pt1 = MapPointBuilder.CreateMapPoint(1.0, 1.0);
MapPoint pt2 = MapPointBuilder.CreateMapPoint(2.0, 2.5);

Geometry geometry = GeometryEngine.Instance.Union(pt1, pt2);
Multipoint multipoint = geometry as Multipoint;   // multipoint has point count of 2
// union two polygons

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);
bool isSimple = GeometryEngine.Instance.IsSimpleAsFeature(poly1);

Envelope env = EnvelopeBuilder.CreateEnvelope(MapPointBuilder.CreateMapPoint(4.0, 4.0), MapPointBuilder.CreateMapPoint(8, 8));
Polygon poly2 = PolygonBuilder.CreatePolygon(env);
isSimple = GeometryEngine.Instance.IsSimpleAsFeature(poly2);

Geometry g = GeometryEngine.Instance.Union(poly1, poly2);
Polygon polyResult = g as Polygon;
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members
Overload List