EnumerateValues Method

Overview

The EnumerateValues method returns an enumerable sequence of all field values in a data row as KeyValuePair<string, object?> items, where the key is the field (column) name and the value is the field value.

This method is a convenience wrapper over IDataRow.Values and can be used to iterate over row fields in a foreach loop.

Declaration

/// <summary>
/// Enumerates values of the inner data row
/// </summary>
/// <param name="observableDataRow">Observable data row</param>
/// <returns>Enumerated values as (ColumnName, Value) pairs</returns>
public static IEnumerable<KeyValuePair<string, object?>> EnumerateValues(this IObservableDataRow dataRow)

Namespace and Assembly

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

Usage Example

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

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

IObservableDataRow departmentObservableDataRow = departmentObservableDataTable.AddNewRow();
departmentObservableDataRow["Id"] = 1;
departmentObservableDataRow["Name"] = "Sales";

// 3. Enumerate all values in the row
foreach (KeyValuePair<string, object?> pair in departmentObservableDataRow.EnumerateValues())
{
    string fieldName = pair.Key;
    object? fieldValue = pair.Value;
}

 

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