public static RowCursor Search(this BasicFeatureLayer searchLayer, Geometry searchGeometry, SpatialRelationship spatialRelationship)
{
RowCursor rowCursor = null;
// define a spatial query filter
var spatialQueryFilter = new SpatialQueryFilter
{
// passing the search geometry to the spatial filter
FilterGeometry = searchGeometry,
// define the spatial relationship between search geometry and feature class
SpatialRelationship = spatialRelationship
};
// apply the spatial filter to the feature layer in question
rowCursor = searchLayer.Search(spatialQueryFilter);
return rowCursor;
}