Clear Method

Overview

As the name of the method Clear suggests, it clears observable data set by removing all rows from all tables but keeps data set schema (tables and their columns) intact.

Declaration

/// <summary>
/// Clears all rows from all tables in the observable data set.
/// Keeps schema (tables and columns) intact.
/// </summary>
/// <param name="observableDataSet">Observable data set</param>
public static void Clear(this IObservableDataSet? observableDataSet)

Namespace and Assembly

Namespace: PocoDataSet.ObservableExtensions
Assembly: PocoDataSet.ObservableExtensions.dll

Usage Example

// 1. Create observable data set
IObservableDataSet observableDataSet = new ObservableDataSet();

// 2. Create Department observable data table with one row
IObservableDataTable departmentObservableDataTable = observableDataSet.AddNewTable("Department");
departmentObservableDataTable.AddColumn("Id", DataTypeNames.INT32);
departmentObservableDataTable.AddColumn("Name", DataTypeNames.STRING);

IObservableDataRow departmentObservableDataRow = departmentObservableDataTable.AddNewRow();
departmentObservableDataRow.UpdateDataFieldValue("Id", 1);
departmentObservableDataRow.UpdateDataFieldValue("Name", "Customer Service");

// 3. Call Clear method and observe that Department observable data table has no rows anymore
observableDataSet.Clear();

 

Table of Content POCO DataSet Observable Data Set 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.