GetFieldValue Method

Overview

The GetFieldValue method retrieves a strongly typed value from a specific table, row, and column (case insensitive) within an IObservableDataSet. It is a convenience wrapper that performs table lookup, bounds checking, and column validation before delegating value extraction to ObservableDataRowExtensions.GetDataFieldValue.

This method is useful when you need to read a single value without directly navigating tables and rows or casting from object.

Declaration

/// <summary>
/// Gets field value
/// </summary>
/// <typeparam name="T">Value type</typeparam>
/// <param name="observableDataSet">Observable data set</param>
/// <param name="tableName">Table name</param>
/// <param name="rowIndex">Row index</param>
/// <param name="columnName">Column name</param>
/// <returns>Value</returns>
public static T? GetFieldValue<T>(this IObservableDataSet? observableDataSet, string tableName, int rowIndex, string columnName)

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["Id"] = 1;
departmentObservableDataRow["Name"] = "Reception";

// 3. Call GetFieldValue method
string? departmentName = observableDataSet.GetFieldValue<string>("Department", 0, "Name");

 

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.