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
tableDataTableThe table which contains the row.
rowDataRowThe row whose column value to get.
namestringThe name of the column to get.
fieldTThe 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
Type Parameters
TThe 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.