I have a function that calls another (static) function which returns a list of features:
<SPAN class="keyword token">private</SPAN> Feature <SPAN class="token function">GetNextFeature</SPAN><SPAN class="punctuation token">(</SPAN>FeatureLayer featLayer<SPAN class="punctuation token">,</SPAN> MapPoint point<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">await</SPAN> QueuedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> featList <SPAN class="operator token">=</SPAN> Utils<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetFeaturesThatIntersectPoint</SPAN><SPAN class="punctuation token">(</SPAN>point<SPAN class="punctuation token">,</SPAN> featLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Do some more with the feature list</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN><SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">static</SPAN> List<SPAN class="operator token"><</SPAN>Feature<SPAN class="operator token">></SPAN> <SPAN class="token function">GetFeaturesThatIntersectPoint</SPAN><SPAN class="punctuation token">(</SPAN>MapPoint point<SPAN class="punctuation token">,</SPAN> FeatureLayer featLayer<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
List<SPAN class="operator token"><</SPAN>Feature<SPAN class="operator token">></SPAN> featList <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">List</SPAN><SPAN class="operator token"><</SPAN>Feature<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create spatial query filter</SPAN>
SpatialQueryFilter spatialFilter <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">SpatialQueryFilter</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
FilterGeometry <SPAN class="operator token">=</SPAN> point<SPAN class="punctuation token">,</SPAN>
SpatialRelationship <SPAN class="operator token">=</SPAN> SpatialRelationship<SPAN class="punctuation token">.</SPAN>Intersects<SPAN class="punctuation token">,</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Query the feature layer</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN>RowCursor rowCursor <SPAN class="operator token">=</SPAN> featLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Search</SPAN><SPAN class="punctuation token">(</SPAN>spatialFilter<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">while</SPAN> <SPAN class="punctuation token">(</SPAN>rowCursor<SPAN class="punctuation token">.</SPAN><SPAN class="token function">MoveNext</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
Row row <SPAN class="operator token">=</SPAN> rowCursor<SPAN class="punctuation token">.</SPAN>Current<SPAN class="punctuation token">;</SPAN>
featList<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>Feature<SPAN class="punctuation token">)</SPAN>row<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">return</SPAN> featList<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>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.