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


IFeatureClass.GetFeature Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (GeoDatabase)  

IFeatureClass.GetFeature Method

Get the feature with the specified object ID.

[Visual Basic .NET]
Public Function GetFeature ( _
    ByVal ID As Integer _
) As IFeature
[C#]
public IFeature GetFeature (
    int ID
);
[C++]
HRESULT GetFeature(
  long ID
);
[C++]

Parameters ID [in]
ID is a parameter of type long

Product Availability

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

Errors Returned

An error with the code FDO_E_FEATURE_NOT_FOUND will be raised if an invalid Object ID is specified.

Remarks

GetFeature will return a feature from the feature class with the parameter-specified Object ID (OID). This method is typically used to find a particular feature with a known Object ID.  A cursor should be used to iterate through all features in a feature class.

Calling the GetFeature method on a feature class (via the IFeatureClass interface on the feature class) has the same effect as calling the GetRow method on the feature class (via the ITable interface) except that the return value is an IFeature reference, rather than IRow.

See Also

IFeatureClass Interface | IObject Interface | IFeature Interface | IFeatureCursor Interface

.NET Snippets

Create Animation from Path

.NET Samples

Executing geoprocessing tools in the background (Code Files: RunGPForm) | Implementing associations between GIS features and schematic features (Code Files: ElementFeatureAssociation) | ArcGIS Network Analyst extension barrier location editor (Code Files: EditorForm)

.NET Related Topics

Accessing a raster dataset in a raster catalog | DataSourcesRaster | Geodatabase | Geodatabase API best practices | How to animate the camera along a path (line feature) in globe | How to load a raster dataset to the raster field in a feature class | How to merge conflicting geometries during a reconcile | Validating features