Class DataRowViewExtensions
A helper class for returning typed values from a DataRowView in a safe manner, by leveraging the existing DataRowExtensions.
public static class DataRowViewExtensions
- Inheritance
-
DataRowViewExtensions
- Inherited Members
Methods
AsBoolean(DataRowView, int)
Returns the value of the column at the specified index as a bool, or false if the value is null or DBNull.
public static bool AsBoolean(this DataRowView drv, int ColumnIndex)
Parameters
drvDataRowViewColumnIndexint
Returns
AsBoolean(DataRowView, int, bool)
Returns the value of the column at the specified index as a bool, or Default if the value is null or DBNull.
public static bool AsBoolean(this DataRowView drv, int ColumnIndex, bool Default)
Parameters
drvDataRowViewColumnIndexintDefaultbool
Returns
AsBoolean(DataRowView, string)
Returns the value of the specified column as a bool, or false if the value is null or DBNull.
public static bool AsBoolean(this DataRowView drv, string ColumnName)
Parameters
drvDataRowViewColumnNamestring
Returns
AsBoolean(DataRowView, string, bool)
Returns the value of the specified column as a bool, or Default if the value is null or DBNull.
public static bool AsBoolean(this DataRowView drv, string ColumnName, bool Default)
Parameters
drvDataRowViewColumnNamestringDefaultbool
Returns
AsDateTime(DataRowView, int)
Returns the value of the column at the specified index as a DateTime, or MinValue if the value is null or DBNull.
public static DateTime AsDateTime(this DataRowView drv, int ColumnIndex)
Parameters
drvDataRowViewColumnIndexint
Returns
AsDateTime(DataRowView, int, DateTime)
Returns the value of the column at the specified index as a DateTime, or Default if the value is null or DBNull.
public static DateTime AsDateTime(this DataRowView drv, int ColumnIndex, DateTime Default)
Parameters
drvDataRowViewColumnIndexintDefaultDateTime
Returns
AsDateTime(DataRowView, string)
Returns the value of the specified column as a DateTime, or MinValue if the value is null or DBNull.
public static DateTime AsDateTime(this DataRowView drv, string ColumnName)
Parameters
drvDataRowViewColumnNamestring
Returns
AsDateTime(DataRowView, string, DateTime)
Returns the value of the specified column as a DateTime, or Default if the value is null or DBNull.
public static DateTime AsDateTime(this DataRowView drv, string ColumnName, DateTime Default)
Parameters
drvDataRowViewColumnNamestringDefaultDateTime
Returns
AsDecimal(DataRowView, int)
Returns the value of the column at the specified index as a decimal, or zero if the value is null or DBNull.
public static decimal AsDecimal(this DataRowView drv, int ColumnIndex)
Parameters
drvDataRowViewColumnIndexint
Returns
AsDecimal(DataRowView, int, decimal)
Returns the value of the column at the specified index as a decimal, or Default if the value is null or DBNull.
public static decimal AsDecimal(this DataRowView drv, int ColumnIndex, decimal Default)
Parameters
drvDataRowViewColumnIndexintDefaultdecimal
Returns
AsDecimal(DataRowView, string)
Returns the value of the specified column as a decimal, or zero if the value is null or DBNull.
public static decimal AsDecimal(this DataRowView drv, string ColumnName)
Parameters
drvDataRowViewColumnNamestring
Returns
AsDecimal(DataRowView, string, decimal)
Returns the value of the specified column as a decimal, or Default if the value is null or DBNull.
public static decimal AsDecimal(this DataRowView drv, string ColumnName, decimal Default)
Parameters
drvDataRowViewColumnNamestringDefaultdecimal
Returns
AsDouble(DataRowView, int)
Returns the value of the column at the specified index as a double, or zero if the value is null or DBNull.
public static double AsDouble(this DataRowView drv, int ColumnIndex)
Parameters
drvDataRowViewColumnIndexint
Returns
AsDouble(DataRowView, int, double)
Returns the value of the column at the specified index as a double, or Default if the value is null or DBNull.
public static double AsDouble(this DataRowView drv, int ColumnIndex, double Default)
Parameters
drvDataRowViewColumnIndexintDefaultdouble
Returns
AsDouble(DataRowView, string)
Returns the value of the specified column as a double, or zero if the value is null or DBNull.
public static double AsDouble(this DataRowView drv, string ColumnName)
Parameters
drvDataRowViewColumnNamestring
Returns
AsDouble(DataRowView, string, double)
Returns the value of the specified column as a double, or Default if the value is null or DBNull.
public static double AsDouble(this DataRowView drv, string ColumnName, double Default)
Parameters
drvDataRowViewColumnNamestringDefaultdouble
Returns
AsInteger(DataRowView, int)
Returns the value of the column at the specified index as an int, or zero if the value is null or DBNull.
public static int AsInteger(this DataRowView drv, int ColumnIndex)
Parameters
drvDataRowViewColumnIndexint
Returns
AsInteger(DataRowView, int, int)
Returns the value of the column at the specified index as an int, or Default if the value is null or DBNull.
public static int AsInteger(this DataRowView drv, int ColumnIndex, int Default)
Parameters
drvDataRowViewColumnIndexintDefaultint
Returns
AsInteger(DataRowView, string)
Returns the value of the specified column as an int, or zero if the value is null or DBNull.
public static int AsInteger(this DataRowView drv, string ColumnName)
Parameters
drvDataRowViewColumnNamestring
Returns
AsInteger(DataRowView, string, int)
Returns the value of the specified column as an int, or Default if the value is null or DBNull.
public static int AsInteger(this DataRowView drv, string ColumnName, int Default)
Parameters
drvDataRowViewColumnNamestringDefaultint
Returns
AsObject(DataRowView, int, object)
Returns the value of the column at the specified index as an object, or Default if the value is null or DBNull.
public static object AsObject(this DataRowView drv, int ColumnIndex, object Default)
Parameters
drvDataRowViewColumnIndexintDefaultobject
Returns
AsObject(DataRowView, string, object)
Returns the value of the specified column as an object, or Default if the value is null or DBNull.
public static object AsObject(this DataRowView drv, string ColumnName, object Default)
Parameters
drvDataRowViewColumnNamestringDefaultobject
Returns
AsString(DataRowView, int)
Returns the value of the column at the specified index as a string, or an empty string if the value is null or DBNull.
public static string AsString(this DataRowView drv, int ColumnIndex)
Parameters
drvDataRowViewColumnIndexint
Returns
AsString(DataRowView, int, string)
Returns the value of the column at the specified index as a string, or Default if the value is null or DBNull.
public static string AsString(this DataRowView drv, int ColumnIndex, string Default)
Parameters
drvDataRowViewColumnIndexintDefaultstring
Returns
AsString(DataRowView, string)
Returns the value of the specified column as a string, or an empty string if the value is null or DBNull.
public static string AsString(this DataRowView drv, string ColumnName)
Parameters
drvDataRowViewColumnNamestring
Returns
AsString(DataRowView, string, string)
Returns the value of the specified column as a string, or Default if the value is null or DBNull.
public static string AsString(this DataRowView drv, string ColumnName, string Default)
Parameters
drvDataRowViewColumnNamestringDefaultstring
Returns
BlobToStream(DataRowView, string)
Returns the contents of the specified blob field as a new MemoryStream.
public static MemoryStream BlobToStream(this DataRowView drv, string FieldName)
Parameters
drvDataRowViewFieldNamestring
Returns
BlobToStream(DataRowView, string, Stream)
Writes the contents of the specified blob field to Stream.
public static void BlobToStream(this DataRowView drv, string FieldName, Stream Stream)
Parameters
drvDataRowViewFieldNamestringStreamStream
BlobToString(DataRowView, string)
Returns the contents of the specified blob field as a string.
public static string BlobToString(this DataRowView drv, string BlobFieldName)
Parameters
drvDataRowViewBlobFieldNamestring
Returns
CopyTo(DataRowView, DataRowView)
Copies the values of Source to Dest.
public static void CopyTo(this DataRowView Source, DataRowView Dest)
Parameters
SourceDataRowViewDestDataRowView
LoadFromStream(DataRowView, string, Stream)
Reads the contents of Stream and stores them in the specified blob field.
public static void LoadFromStream(this DataRowView drv, string BlobFieldName, Stream Stream)
Parameters
drvDataRowViewBlobFieldNamestringStreamStream
SafeCopyTo(DataRowView, DataRowView)
Safely copies the values of Source to Dest, copying only columns that exist in both rows.
public static void SafeCopyTo(this DataRowView Source, DataRowView Dest)
Parameters
SourceDataRowViewDestDataRowView
SaveToStream(DataRowView, string, Stream)
Writes the contents of the specified blob field to Stream.
public static void SaveToStream(this DataRowView drv, string BlobFieldName, Stream Stream)
Parameters
drvDataRowViewBlobFieldNamestringStreamStream
StreamToBlob(DataRowView, string, Stream)
Reads the contents of Stream and stores them in the specified blob field.
public static void StreamToBlob(this DataRowView drv, string FieldName, Stream Stream)
Parameters
drvDataRowViewFieldNamestringStreamStream
StringToBlob(DataRowView, string, string)
Converts Value to bytes and stores it in the specified blob field.
public static void StringToBlob(this DataRowView drv, string BlobFieldName, string Value)
Parameters
drvDataRowViewBlobFieldNamestringValuestring
TryGetValue(DataRowView, string, out object)
Returns true and sets Value to the value of the specified field, if the field exists; otherwise returns false.
public static bool TryGetValue(this DataRowView drv, string FieldName, out object Value)
Parameters
drvDataRowViewFieldNamestringValueobject