I have a function that calls another (static) function which returns a list of features:
private Feature GetNextFeature(FeatureLayer featLayer, MapPoint point)
await QueuedTask.Run(() =>
var featList = Utils.GetFeaturesThatIntersectPoint(point, featLayer);
// Do some more with the feature list
public static List<Feature> GetFeaturesThatIntersectPoint(MapPoint point, FeatureLayer featLayer)
List<Feature> featList = new List<Feature>();
// Create spatial query filter
SpatialQueryFilter spatialFilter = new SpatialQueryFilter()
FilterGeometry = point,
SpatialRelationship = SpatialRelationship.Intersects,
// Query the feature layer
using (RowCursor rowCursor = featLayer.Search(spatialFilter))
Row row = rowCursor.Current;
In the method "GetFeaturesThatIntersectPoint", the feature list is correct. However, in the calling function "GetNextFeature", the features in the list are not the same any more. What am I doing wrong?
As a workaround, I don't return a list of features, but a list of oids (of the features). This list is correct.