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,
  IFeature** Feature
);
[C++]

Parameters

ID [in]   ID is a parameter of type long Feature [out, retval]

  Feature is a parameter of type IFeature

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 | IFeature Interface | IFeatureCursor Interface