ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Data Namespace / QueryFilter Class
Members Example

In This Topic
    QueryFilter Class
    In This Topic
    Represents a filter for performing a query against a Table.
    Object Model
    QueryFilter ClassSpatialReference Class
    Syntax
    public class QueryFilter 
    Public Class QueryFilter 
    Example
    Querying a feature layer
    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));
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.QueryFilter
          ArcGIS.Core.Data.SpatialQueryFilter

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also