Solved! Go to Solution.
public IFeature getFeature(Point point, IGeoFeatureLayer geoFeatureLayer, IActiveView activeView, System.Double searchTolerance) { if (searchTolerance < 0 || point == null || geoFeatureLayer == null || activeView == null){return null;} IMap map = activeView.FocusMap; // Expand the points envelope to give better search results ESRI.ArcGIS.Geometry.IEnvelope envelope = point.Envelope; envelope.Expand(searchTolerance, searchTolerance, false); ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = geoFeatureLayer.FeatureClass; System.String shapeFieldName = featureClass.ShapeFieldName; // Create a new spatial filter and use the new envelope as the geometry ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass(); spatialFilter.Geometry = envelope; spatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelEnvelopeIntersects; spatialFilter.set_OutputSpatialReference(shapeFieldName, map.SpatialReference); spatialFilter.GeometryField = shapeFieldName; // Do the search ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = geoFeatureLayer.Search(spatialFilter, false); feature = featureCursor.NextFeature(); return feature; }