/// <summary> /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// </summary> /// <param name="row">The input DataRow</param> /// <param name="columnName">The input column name specificy which row value to retrieve.</param> /// <param name="version">The DataRow version for which row value to retrieve.</param> /// <returns>The DataRow value for the column specified.</returns> public static T Field<T>(this DataRow row, string columnName, DataRowVersion version) { DataSetUtil.CheckArgumentNull(row, nameof(row)); return UnboxT<T>.s_unbox(row[columnName, version]); }
/// <summary> /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// </summary> /// <param name="row">The input DataRow</param> /// <param name="columnIndex">The input ordinal specificy which row value to retrieve.</param> /// <returns>The DataRow value for the column specified.</returns> public static T Field<T>(this DataRow row, int columnIndex) { DataSetUtil.CheckArgumentNull(row, nameof(row)); return UnboxT<T>.s_unbox(row[columnIndex]); }
public static T Field <T>(this DataRow row, int columnIndex, DataRowVersion version) { DataSetUtil.CheckArgumentNull(row, nameof(row)); return(UnboxT <T> .s_unbox(row[columnIndex, version])); }
public static T Field <T>(this DataRow row, DataColumn column) { DataSetUtil.CheckArgumentNull(row, nameof(row)); return(UnboxT <T> .s_unbox(row[column])); }
/// <summary> /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// </summary> /// <param name="row">The input DataRow</param> /// <param name="columnName">The input column name specifying which row value to retrieve.</param> /// <returns>The DataRow value for the column specified.</returns> public static T?Field <T>(this DataRow row, string columnName) { DataSetUtil.CheckArgumentNull(row, nameof(row)); return(UnboxT <T> .s_unbox(row[columnName])); }
/// <summary> /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// </summary> /// <param name="row">The input DataRow</param> /// <param name="column">The input DataColumn specificy which row value to retrieve.</param> /// <param name="version">The DataRow version for which row value to retrieve.</param> /// <returns>The DataRow value for the column specified.</returns> public static T Field <T>(this DataRow row, DataColumn column, DataRowVersion version) { DataSetUtil.CheckArgumentNull(nameof(row), "row"); return(UnboxT <T> .s_unbox(row[column, version])); }