I have a polyline and polygon. The polyline will intersect the polygon at two or fewer points. I would like to get these intersection points as X and Y values.
EDIT: Here is a quick code sample using ITopologicalOperator based on the answers below. It's a quick chop job, but it'll help get others started.
Public Function GetPolygonIntersection(ByVal pLine As IPolyline, ByVal pPolygon As IPolygon) As IPoint
Dim pGeom As IGeometry
Dim pTopo As ITopologicalOperator = pLine
Dim pPoints As IPointCollection
Dim pPoint As IPoint = Nothing
If Not pTopo.IsSimple Then pTopo.Simplify()
pGeom = pTopo.Intersect(pPolygon, esriGeometry0Dimension)
If pGeom.IsEmpty Then
Return Nothing
End If
If pGeom.GeometryType = esriGeometryMultipoint Then
pPoints = pGeom
If pPoints.PointCount = 1 Then
pPoint = pPoints.Point(0)
End If
End If
Return pPoint
End Function