CleaRows Method

Overview

The CleaRows method is intended to be an alias for Clear, providing an alternate name for clearing all rows from all tables while keeping the data set schema intact.

Declaration

/// <summary>
/// Alias for Clear method
/// Clears all rows from all tables in the data set.
/// Keeps schema (tables and columns) intact.
/// </summary>
/// <param name="dataSet">Data set.</param>
public static void CleaRows(this IDataSet? dataSet)

Namespace and Assembly

Namespace: PocoDataSet.Extensions
Assembly: PocoDataSet.Extensions.dll

Behavior

Usage Example

// 1. Create data set
IDataSet dataSet = DataSetFactory.CreateDataSet();

// 2. Create Employee data table and add columns
IDataTable employeeTable = dataSet.AddNewTable("Employee");
employeeTable.AddColumn("Id", DataTypeNames.INT32);
employeeTable.AddColumn("FirstName", DataTypeNames.STRING);

// 3. Add a new row
IDataRow dataRow = employeeTable.AddNewRow();
dataRow["Id"] = 1;
dataRow["FirstName"] = "Sara";

// 4. Clear all rows from all tables (keeps schema)
dataSet.ClearRows();

// 5. Verify that Employee table has no rows but still has columns
bool noRows = employeeTable.Rows.Count == 0;
bool hasTwoColumns = employeeTable.Columns.Count == 2;

 

Table of Content POCO DataSet DataSet Members

 


Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness or suitability of the information and are not responsible for any damages resulting from its use.