ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / Table Class / GetCount Method / GetCount() Method
Example

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

    Return Value

    The number of rows in this table.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Gets the count of a Table or FeatureClass
    {
      //Must be called within QueuedTask.Run()
      void GetCount(FeatureLayer featureLayer)
      {
        // Row count in a Table
        Table table = featureLayer.GetTable();
        long count = table.GetCount();
    
        // Feature count in a FeatureClass
        FeatureLayer lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
        FeatureClass featureClass = lyr.GetFeatureClass();
        count = featureClass.GetCount();
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also