ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data Namespace / Table Class / GetCount Method / GetCount(QueryFilter) Method
Used to filter the count of how many rows are currently in this Table. If set to null, all the number of rows will be returned.
Example

In This Topic
    GetCount(QueryFilter) Method
    In This Topic
    Gets the count of how many rows are currently in this Table that satisfy the criteria set in the queryFilter. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public long GetCount( 
       QueryFilter queryFilter
    )
    Public Overloads Function GetCount( _
       ByVal queryFilter As QueryFilter _
    ) As Long

    Parameters

    queryFilter
    Used to filter the count of how many rows are currently in this Table. If set to null, all the number of rows will be returned.

    Return Value

    The number of rows in this table.
    Exceptions
    ExceptionDescription
    If queryFilter is an instance of SpatialQueryFilter, either both the 'FilterGeometry' and 'SpatialRelationship' properties are set or both are not set. Otherwise, an ArgumentException will be raised.
    A geodatabase-related exception has occurred.
    Example
    Gets the count of how many rows are currently in a Table
    //Note: call within QueuedTask.Run()
    Table table = featureLayer.GetTable();
    long count = table.GetCount();
    Gets the feature count of a layer
    FeatureLayer lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
    QueuedTask.Run(() =>
    {
      FeatureClass featureClass = lyr.GetFeatureClass();
      long nCount = featureClass.GetCount();
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also