AnsweredAssumed Answered

Cannot cast between QueryFilter and SpatialQueryFilter

Question asked by sbuscher on Jul 26, 2016
Latest reply on Jul 27, 2016 by sbuscher

I'm trying to cast from a SpatialQueryFilter up to a QueryFilter:

 

var spatialQueryFilter = new SpatialQueryFilter();

QueryFilter queryFilter = spatialQueryFilter;

 

However, the result type of the implicit cast for queryFilter is still SpatialQueryFilter.  Casting (explicitly) the other way around does not work either.

 

Ultimately I want to pass either a QueryFilter or its SpatialQueryFilter subclass into FeatureLayer.FeatureTable.QueyAsync(QueryFilter).  Without being able to cast a SpatialQueryFilter to a QueryFilter, QueryAsync always returns no results because the Geometry property is null. I understand there are workarounds for this, but am wondering why the casts aren't working?

Outcomes