public RowCursor Search( QueryFilter queryFilter )
Public Overloads Function Search( _ Optional ByVal queryFilter As QueryFilter _ ) As RowCursor
Parameters
- queryFilter
- A query filter or spatial filter to perform spatial search.
public RowCursor Search( QueryFilter queryFilter )
Public Overloads Function Search( _ Optional ByVal queryFilter As QueryFilter _ ) As RowCursor
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
If there is a definition query set on the feature layer, the Search() method will automatically work on the subset of features in the feature layer that meet the definition criteria. You specify an additional query that will be applied after the feature layer's definition query by passing valid QueryFilter object for the QueryFilter parameter.
If the feature layer has any joins, this Search() method takes that into account.
You can use the cursor returned by Search to update features.
To ensure maximum robustness, callers should explicitly dispose of the returned ArcGIS.Core.Data.RowCursor in either a using
statement or a finally
block.
For stream layers, especially with high velocity real-time updates, features might get expired (removed) while you are looping through feature cursor.
var count = await QueuedTask.Run(() => { QueryFilter qf = new QueryFilter() { WhereClause = "Class = 'city'" }; //Getting the first selected feature layer of the map view var flyr = (FeatureLayer)MapView.Active.GetSelectedLayers() .OfType<FeatureLayer>().FirstOrDefault(); using (RowCursor rows = flyr.Search(qf)) //execute { //Looping through to count int i = 0; while (rows.MoveNext()) i++; return i; } }); MessageBox.Show(String.Format( "Total features that matched the search criteria: {0}", count));
Target Platforms: Windows 10, Windows 8.1, Windows 7