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


IPoint.Compare Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

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
[C#]
public int Compare (
    IPoint otherPoint
);
[C++]
HRESULT Compare(
  IPoint* otherPoint,
  Long* result
);
[C++]

Parameters otherPoint
otherPoint is a parameter of type IPoint result [out, retval] result is a parameter of type Long

Product Availability

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

Description

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.

Remarks

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