ArcGIS Pro 2.8 API Reference Guide
Intersection(Geometry,Geometry,GeometryDimension) Method
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface > Intersection Method : Intersection(Geometry,Geometry,GeometryDimension) Method
The first geometry.
The second geometry.
Specifies the required dimension of the output. For example, if geometry1 is a Polyline and geometry2 is a Polyline and they cross each other at two points, then the intersection is a Multipoint. In this case, if you want the returned geometry to be the Multipoint where the input geometries intersect, use GeometryDimension.esriGeometry0Dimension. Note that if the geometries intersect at one point and GeometryDimension.esriGeometry0Dimension is used, the returned geometry will be a Multipoint with one point. In the above example, if GeometryDimension.esriGeometry1Dimension is passed, an empty Polyline will be returned because the geometries intersect only at points. If, on the other hand, the two polylines overlap, then a non-empty Polyline will be returned. If resultDimension is GeometryDimension.esriGeometryNoDimension, then the lowest dimension of the input geometries will be used.
Constructs the set-theoretic intersection between two geometries. Use different resultDimension values to generate results of different dimensions.
Syntax

Parameters

geometry1
The first geometry.
geometry2
The second geometry.
resultDimension
Specifies the required dimension of the output. For example, if geometry1 is a Polyline and geometry2 is a Polyline and they cross each other at two points, then the intersection is a Multipoint. In this case, if you want the returned geometry to be the Multipoint where the input geometries intersect, use GeometryDimension.esriGeometry0Dimension. Note that if the geometries intersect at one point and GeometryDimension.esriGeometry0Dimension is used, the returned geometry will be a Multipoint with one point. In the above example, if GeometryDimension.esriGeometry1Dimension is passed, an empty Polyline will be returned because the geometries intersect only at points. If, on the other hand, the two polylines overlap, then a non-empty Polyline will be returned. If resultDimension is GeometryDimension.esriGeometryNoDimension, then the lowest dimension of the input geometries will be used.

Return Value

A geometry that represents the intersection of the two 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.
Spatial reference of geometry1or geometry2is an image coordinate system.
Remarks
If an input geometry is a Multipatch, then the Multipatch footprint will be used to determine the intersection.

GeometryEngine Intersection

Example
// determine intersection between two polylines

List<MapPoint> pts = new List<MapPoint>();
pts.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0));
pts.Add(MapPointBuilder.CreateMapPoint(3.0, 3.0));
pts.Add(MapPointBuilder.CreateMapPoint(5.0, 1.0));

Polyline line1 = PolylineBuilder.CreatePolyline(pts);

List<MapPoint> pts2 = new List<MapPoint>();
pts2.Add(MapPointBuilder.CreateMapPoint(1.0, 3.0));
pts2.Add(MapPointBuilder.CreateMapPoint(3.0, 1.0));
pts2.Add(MapPointBuilder.CreateMapPoint(5.0, 3.0));

Polyline line2 = PolylineBuilder.CreatePolyline(pts2);

bool intersects = GeometryEngine.Instance.Intersects(line1, line2);    // intersects = true
Geometry g = GeometryEngine.Instance.Intersection(line1, line2, GeometryDimension.esriGeometry0Dimension);
Multipoint resultMultipoint = g as Multipoint;

// result is a multiPoint that intersects at (2,2) and (4,2)
// determine intersection between two polygons

Envelope env1 = EnvelopeBuilder.CreateEnvelope(new Coordinate2D(3.0, 2.0), new Coordinate2D(6.0, 6.0));
Polygon poly1 = PolygonBuilder.CreatePolygon(env1);

Envelope env2 = EnvelopeBuilder.CreateEnvelope(new Coordinate2D(1.0, 1.0), new Coordinate2D(4.0, 4.0));
Polygon poly2 = PolygonBuilder.CreatePolygon(env2);

Polygon polyResult = GeometryEngine.Instance.Intersection(poly1, poly2) as Polygon;
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members
Overload List