IFeatureCursor Interface

Provides access to members that hand out enumerated features, field collections and allows for the updating, deleting and inserting of features.

Members

Name Description
Method DeleteFeature Delete the existing Feature in the database corresponding to the current position of the cursor.
Read-only property Fields The fields Collection for this cursor.
Method FindField The index of the field with the specified name.
Method Flush Flush any outstanding buffered writes to the database.
Method InsertFeature Insert a new Feature into the database using the property values in the input buffer. The ID of the new Feature is returned.
Method NextFeature Advance the position of the cursor by one and return the Feature object at that position.
Method UpdateFeature Update the existing Feature in the database corresponding to the current position of the cursor.

IFeatureCursor.DeleteFeature Method

Delete the existing Feature in the database corresponding to the current position of the cursor.

Public Sub DeleteFeature ( _
)
public void DeleteFeature (
);

Remarks

The cursor must be initialized to a feature (with the NextFeature() method) before this method can be successfully called.

This should only be called on update cursors. To delete a feature retrieved from a search cursor, call IFeature.Delete on the feature itself.

IFeatureCursor.Fields Property

The fields Collection for this cursor.

Public ReadOnly Property Fields As IFields
public IFields Fields {get;}

IFeatureCursor.FindField Method

The index of the field with the specified name.

Public Function FindField ( _
    ByVal Name As String _
) As Integer
public int FindField (
    string Name
);

Remarks

If the specified field cannot be found, this method returns a value of -1.

IFeatureCursor.Flush Method

Flush any outstanding buffered writes to the database.

Public Sub Flush ( _
)
public void Flush (
);

Remarks

This method should only be called on insert cursors.

IFeatureCursor.InsertFeature Method

Insert a new Feature into the database using the property values in the input buffer. The ID of the new Feature is returned.

Public Function InsertFeature ( _
    ByVal buffer As IFeatureBuffer _
) As Object
public object InsertFeature (
    IFeatureBuffer buffer
);

Errors Returned

FDO_E_INVALID_GRID_SIZE: This error can occur if the grid size of the feature class is too small to handle the feature being inserted. To avoid this error, put the feature class into load-only mode (see IFeatureClassLoad) prior to creating the insert cursor and when the inserts are completed take the feature class out of load-only mode. The geodatabase will recalculate an appropriate grid size when load-only mode is turned off.

Remarks

This method should only be called on insert cursors.

IFeatureCursor.NextFeature Method

Advance the position of the cursor by one and return the Feature object at that position.

Public Function NextFeature ( _
) As IFeature
public IFeature NextFeature (
);

Remarks

If you fetch features out of a geodatabase using a cursor (recycling or non recycling), the spatial reference of the feature, as returned by NextFeature, is guaranteed to be in the spatial reference that you specified in the query filter .

No guarantee however is made that the geometry of the feature will continue to remain in this spatial reference. In particular, if you use a non recycling cursor, then the feature you fetch will be shared with other consumers and any one of these may change its spatial reference at any time. It is the developers responsibility to test the spatial reference or the geometry you get from the feature (via IFeature::Shape) if you retrieve the geometry at a later time and rely on its spatial reference being a specified spatial reference.

IFeatureCursor.UpdateFeature Method

Update the existing Feature in the database corresponding to the current position of the cursor.

Public Sub UpdateFeature ( _
    ByVal Object As IFeature _
)
public void UpdateFeature (
    IFeature Object
);

Remarks

This method should only be called on update cursors.

Classes that implement IFeatureCursor

Classes Description
FeatureCursor Esri Feature Cursor object.
RelQueryCursor A cursor that is opened from a RelQueryTable.

Remarks

The IFeatureCursor interface provides access to a set of features in a feature class. It operates in the same way as ICursor, although it does not inherit from that interface. This saves you from having to use Query-Interface when dealing with features rather than rows.

Feature cursors can be used as an input to IFeatureCursorBuffer, which lets you spatially buffer the features by a distance.

You can also draw the features from a cursor on the display. For more information, see the IFeatureRenderer::Draw method.

When using cursors within an edit session, they should always be scoped to edit operations. In other words, a cursor should be created after an edit operation has begun and should not be used once that edit operation has been stopped or aborted.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.