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

IPoint.Compare Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IP > IPoint Interface > IPoint.Compare Method
ArcGIS Developer Help

IPoint.Compare Method

Compares X, Y, M, Z, ID of this point (in that order) with that of the other point. Returns -1 if this point's value is less, 1 if greater, and 0 otherwise. Useful for sorting a group of points.

[Visual Basic .NET]
Public Function Compare ( _
    ByVal otherPoint As IPoint _
) As Integer
public int Compare (
    IPoint otherPoint
HRESULT Compare(
  IPoint* otherPoint

otherPoint is a parameter of type IPoint*

Product Availability

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


Compares the location and attributes of the base point with those of the input point to determine a relative ordering of the two points.  Compares point properties in the following order: X, Y, M, Z, and ID.  Returns 1 if the base point possesses the first greater property, and returns -1 if the input point possesses the first greater property. This method takes the resolution of the spatial reference into account.


The method should not be used in order to determine equality of two points. Use IRelationalOperator::Equals or IClone::IsEqual. At 9.2, this method uses the resolution property of the point's spatial reference in order to determine (x,y) coordinate ordering. At 9.1, an untoleranced (exact) comparison was performed.

See Also

IPoint Interface