Table of Contents

Class DataSetExtensions

Namespace
Garyon.Extensions
Assembly
Garyon.dll

Provides extensions for DataSet and relevant types.

public static class DataSetExtensions
Inheritance
DataSetExtensions
Inherited Members

Methods

ReadField<T>(DataTable, DataRow, string, ref T)

Gets a value from a data row on the given table, by the column name, and casts it onto the specified type.

public static bool ReadField<T>(this DataTable table, DataRow row, string name, ref T field)

Parameters

table DataTable

The table which contains the row.

row DataRow

The row whose column value to get.

name string

The name of the column to get.

field T

The field to store the value into if the column name exists, otherwise the parameter location remains unchanged. For the purposes of not setting the value if not found, it's required to be passed by ref.

Returns

bool

true if the column name was found in the table, otherwise false.

Type Parameters

T

The type to cast the value onto.

Remarks

It is not validated whether the table contains the provided row or not, so long as both the table and the row contain the requested column name, the value is successfully retrieved.