ToList Method

Overview

The ToList method converts all rows in a data table into list of elements.

Namespace and Assembly

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

The first overload

The first overload produces an list of observable data rows.

/// <summary>
/// Gets list of observable data rows
/// </summary>
/// <param name="observableDataTable">Observable data table</param>
/// <returns>List of observable data rows</returns>
public static List<IObservableDataRow> ToList(this IObservableDataTable observableDataTable)

Usage Example

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

// 2. Create Department observable table with row
IObservableDataTable employmentTypeObservableDataTable = observableDataSet.AddNewTable("EmploymentType");
employmentTypeObservableDataTable.AddColumn("Id", DataTypeNames.INT32);
employmentTypeObservableDataTable.AddColumn("Code", DataTypeNames.STRING);
employmentTypeObservableDataTable.AddColumn("Description", DataTypeNames.STRING);

IObservableDataRow employmentTypeObservableDataRow1 = employmentTypeObservableDataTable.AddNewRow();
employmentTypeObservableDataRow1["Id"] = 1;
employmentTypeObservableDataRow1["Code"] = "ET01";
employmentTypeObservableDataRow1["Description"] = "Part Time";

// 3. Call ToList method
List<IObservableDataRow> observableDataRows = employmentTypeObservableDataTable.ToList();

 

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