This document is archived and information here might be outdated.  Recommended version.


IRelationalOperator.Contains Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IR > IRelationalOperator Interface > IRelationalOperator.Contains Method
ArcGIS Developer Help

IRelationalOperator.Contains Method

Indicates if this geometry contains the other geometry.

[Visual Basic .NET]
Public Function Contains ( _
    ByVal other As IGeometry _
) As Boolean
[C#]
public bool Contains (
    IGeometry other
);
[C++]
HRESULT Contains(
  IGeometry* other
);
[C++]
Parameters
other 

other is a parameter of type IGeometry*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

The base geometry contains the comparison geometry (other) if the comparison geometry is a subset of the base geometry and the intersection of their interiors is not empty. Therefore a polygon does not contain any part of its 1D boundary. Contains is the opposite operator of Within.

Remarks

Only geometries that support the IRelationalOperator interface can be used as input geometries.

If geometry1 Contains geometry2, then geometry2 is Within geometry1.

An empty geometry does not contain another geometry.  On the other hand, an empty geometry is contained in another geometry, unless the other geometry is empty.

Contains examples. Only "true" relationships are showed in this picture.

See Also

IRelationalOperator Interface

.NET Samples

Geoevents in a MapControl