GetFieldValue Method
The GetFieldValue method reads a field value from a table row and returns it as a strongly typed value.
It is a table-level convenience wrapper that validates the row index and column name (case insensitive) before delegating the actual
value extraction to ObservableDataRowExtensions.GetDataFieldValue<T>.
/// <summary>
/// Gets field value from row at row with specified index
/// </summary>
/// <typeparam name="T">Value type</typeparam>
/// <param name="observableDataTable">Observable data table</param>
/// <param name="columnName">Column name</param>
/// <returns>Field value from row at row with specified index</returns>
public static T? GetFieldValue<T>(this IObservableDataTable? dataTable, int rowIndex, string columnName)
Namespace: PocoDataSet.ObservableExtensions
Assembly: PocoDataSet.ObservableExtensions.dll
dataTable is null, returns default(T).rowIndex is within [0..Rows.Count-1]; otherwise throws.columnName (using ContainsColumn); otherwise throws.ObservableDataRowExtensions.GetDataFieldValue<T>(dataRow, columnName).
// 1. Create observable data set
IObservableDataSet observableDataSet = new ObservableDataSet();
// 2. Create Department observable table with row
IObservableDataTable departmentObservableDataTable = observableDataSet.AddNewTable("Department");
departmentObservableDataTable.AddColumn("Id", DataTypeNames.INT32);
departmentObservableDataTable.AddColumn("Name", DataTypeNames.STRING);
IObservableDataRow departmentObservableDataRow1 = departmentObservableDataTable.AddNewRow();
departmentObservableDataRow1["Id"] = 1;
departmentObservableDataRow1["Name"] = "Reception";
// 3. Get department name as string
string? departmentName = departmentObservableDataTable.GetFieldValue<string>(0, "name");
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.