Difference between RowCount and Rows.Count?

Hi Team,
I have concern that what is the Difference between RowCount and Rows.Count?

both gives the same result (Dt total row count)

Hi @Sanket_Shinde1

Both works same and gives the output as rows count of a datatable.

RowCount : RowCount is a property that belongs to a DataTable variable. It returns the total number of rows present in the DataTable. This property is used when you want to know how many rows are there in a specific DataTable.

Rows.Count : Rows is a collection property of a DataTable variable that represents the entire collection of DataRow objects within that DataTable. Rows.Count specifically gives you the count of the rows in the DataRow collection of the DataTable.

Hope it helps!!

1 Like

@Sanket_Shinde1,

In UiPath, DataTable.Rows.Count and DataTable.Rows.Count both refer to properties related to the number of rows in a DataTable, but they come from different namespaces and have different underlying implementations:

  1. DataTable.Rows.Count:
  • This property belongs to the System.Data.DataTable class in the .NET Framework’s System.Data namespace.
  • It returns the number of rows in the DataTable.
  • You typically use it when working directly with DataTable objects in .NET applications or when using the UiPath Studio’s “Invoke Code” activity to interact with .NET objects directly.

Example:

dataTable.Rows.Count
  1. DataTable.Rows.Count:
  • This property is provided by the UiPath Studio’s activities for DataTable manipulation.
  • It also returns the number of rows in the DataTable.
  • You typically use it within UiPath workflows, especially when using activities like “For Each Row” or other DataTable-related activities.

Example:

dataTable.Rows.Count

In summary, both DataTable.Rows.Count and DataTable.Rows.Count serve the same purpose of providing the count of rows in a DataTable, but the former is used in .NET development contexts, while the latter is used within UiPath workflows.

Thanks,
Ashok :slight_smile:

1 Like

hello @Sanket_Shinde1

  1. RowCount : RowCount is a property of the DataTable object itself. It returns the number of rows in the DataTable. It is primarily used when you’re directly interacting with a DataTable variable.

  2. Rows.Count : Rows is a collection of DataRow objects within the DataTable. Rows.Count is a property of this collection, returning the number of DataRow objects in the collection.

And Also

  • RowCount is accessed directly from the DataTable object itself.
  • Rows.Count is accessed from the collection of DataRow objects within the DataTable.

Regards,
Dheerandra Vishwakarma

1 Like

RowCount is an extension which was introduced at a later stage by UiPath
grafik

UPD1:

DataTable.Rows.Count is a Property:

Both will give the same value, but RowCount is maybe not available (depending on package versions)

3 Likes

Thank you so much All , I really appreciate your valuable answers.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.