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


IFeatureClass.GetFeature Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IF > IFeatureClass Interface > IFeatureClass.GetFeature Method
ArcGIS Developer Help

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 Samples

Executing geoprocessing tools in the background ArcGIS Network Analyst extension barrier location editor Implementing associations between GIS features and schematic features