I have a recycling feature cursor that is used to fetch a single row. Is it my responsibility to release that returned feature, or will it be cleaned up by the cursor as it would be if I consumed the entire cursor?
public object GetFirstValue(IFeatureClass featureClass, string field)
{
IFeatureCursor cursor;
IFeature feature;
try
{
cursor = featureClass.Search(null, true);
feature = cursor.NextFeature();
return feature.get_Value(feature.Fields.FindField(field));
}
finally
{
if(cursor != null) Marshal.ReleaseComObject(cursor);
//do I need to release the feature here?
}
}