ArcGIS Enterprise SDK
IPointCollection.UpdatePoint Method
ArcGIS Developer Help

IPointCollection.UpdatePoint Method

Changes the ith vertex or point to be a copy of the input point.

[Visual Basic .NET]
Public Sub UpdatePoint ( _
    ByVal i As Integer, _
    ByVal p As IPoint _
public void UpdatePoint (
    int i,
    IPoint p


Updates the ith Point with a copy of the input Point.  Update replaces the reference to the indexed point with a reference to the input Point.


For efficiency UpdatePoint does not check if the spatial reference of the input point is equal to the spatial reference of the PointCollection. Please make sure that the spatial reference of the input point is equal to the spatial reference of the PointCollection before you pass the point in.

Note : You can also explicitly check the spatial reference by using IClone::IsEqual


//Point to use in the UpdatePoint call
IPoint point = new PointClass() as IPoint;

//Point Collection to UpdatePoint
IPointCollection ptCollection = new MultipointClass() as IPointCollection;

//Set the spatial reference of the Point Collection usually it has already been set
ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass() as ISpatialReferenceFactory;
IGeometry geom = ptCollection as IGeometry;
geom.SpatialReference = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983N_AmericaLambert);
ISpatialReference sr = geom.SpatialReference;

//This line does nothing if the two spatial references are already equal

//The integer is the number of point in the point collection you are updating
ptCollection.UpdatePoint(1, point);

See Also

IPointCollection Interface