Class DataRecordExtensions
Useful extension methods for System.Data.IDataRecord.
Inherited Members
Namespace: IRM.Data
Assembly: IRM.dll
Syntax
public static class DataRecordExtensions
Methods
GetValue<TType>(IDataRecord, Int32, Boolean)
Gets a typed value from a specified index.
Declaration
public static TType GetValue<TType>(this IDataRecord dataRecord, int index, bool treatEmptyStringsAsNull = true)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
Boolean
treatEmptyStringsAsNull
true (default) to return null for an empty string; otherwise false. |
Returns
|
TType
The typed value for the specified |
Type Parameters
|
TType
The type of the value to return. |
GetValue<TType>(IDataRecord, String, Boolean)
Gets a typed value from a specified index.
Declaration
public static TType GetValue<TType>(this IDataRecord dataRecord, string column, bool treatEmptyStringsAsNull = true)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
column
The name of the column to get the value for. |
|
Boolean
treatEmptyStringsAsNull
true (default) to return null for an empty string; otherwise false. |
Returns
|
TType
The typed value for the specified |
Type Parameters
|
TType
The type of the value to return. |
Parse<T>(IDataRecord, Int32, Func<IDataRecord, Int32, T>)
Gets a typed value from a column with a specified index in a System.Data.IDataRecord using a Func.
Declaration
public static T Parse<T>(this IDataRecord dataRecord, int index, Func<IDataRecord, int, T> parser)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Func<System.Data.IDataRecord, System.Int32, T>
parser
The Func that parses the value from the datarecord. |
Returns
|
T
The typed value for the specified |
Type Parameters
|
T
The type of the value to return. |
Parse<T>(IDataRecord, String, Func<IDataRecord, String, T>)
Gets a typed value from a column with a specified name in a System.Data.IDataRecord using a Func.
Declaration
public static T Parse<T>(this IDataRecord dataRecord, string columnName, Func<IDataRecord, string, T> parser)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get the value from. |
|
System.Func<System.Data.IDataRecord, String, T>
parser
The Func that parses the value from the datarecord. |
Returns
|
T
The typed value for the column with the name |
Type Parameters
|
T
The type of the value to return. |
ParseBoolean(IDataRecord, Int32)
Parses a boolean value from a column of type string using the index of the column.
Declaration
public static bool ParseBoolean(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
Boolean
The parsed boolean value, false if the conversion fails. |
ParseBoolean(IDataRecord, String)
Parses a boolean value from a column of type string using the name of the column.
Declaration
public static bool ParseBoolean(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get the value from. |
Returns
|
Boolean
The parsed boolean value, false if the conversion fails. |
ParseBooleanValueFromZeroOrOne(IDataRecord, Int32)
Parses a column containing "1" or "0" to a boolean value.
Declaration
public static bool ParseBooleanValueFromZeroOrOne(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
Boolean
true if the column is "1"; otherwise false. |
ParseDateTime(IDataRecord, Int32)
Parses a DateTime value from a column of type string using the index of the column.
Declaration
public static DateTime ParseDateTime(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDateTime(IDataRecord, Int32, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the index of the column, the culture-specific format information and the formatting style.
Declaration
public static DateTime ParseDateTime(this IDataRecord dataRecord, int index, IFormatProvider provider, DateTimeStyles styles)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
styles
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDateTime(IDataRecord, Int32, String)
Parses a column value to a System.DateTime value.
Declaration
public static DateTime? ParseDateTime(this IDataRecord dataRecord, int index, string format)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
String
format
The required format of the column value. |
Returns
|
System.Nullable<System.DateTime>
The System.DateTime if the column value matches the |
ParseDateTime(IDataRecord, String)
Parses a DateTime value from a column of type string using the name of the column.
Declaration
public static DateTime ParseDateTime(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDateTime(IDataRecord, String, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the name of the column, the culture-specific format information and the formatting style.
Declaration
public static DateTime ParseDateTime(this IDataRecord dataRecord, string columnName, IFormatProvider provider, DateTimeStyles styles)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
styles
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDateTimeExact(IDataRecord, Int32, String, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the index of the column, the required format of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime ParseDateTimeExact(this IDataRecord dataRecord, int index, string format, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
String
format
The required format of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDateTimeExact(IDataRecord, Int32, String[], IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the index of the column, the allowed formats of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime ParseDateTimeExact(this IDataRecord dataRecord, int index, string[] formats, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
String[]
formats
An array of allowable formats of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDateTimeExact(IDataRecord, String, String, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the name of the column, the required format of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime ParseDateTimeExact(this IDataRecord dataRecord, string columnName, string format, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
String
format
The required format of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDateTimeExact(IDataRecord, String, String[], IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the name of the column, the allowed formats of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime ParseDateTimeExact(this IDataRecord dataRecord, string columnName, string[] formats, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
String[]
formats
An array of allowable formats of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.DateTime
The parsed DateTime value, DateTime.MinValue if the conversion fails. |
ParseDecimal(IDataRecord, Int32)
Parses a decimal value from a column of type string using the index of the column.
Declaration
public static decimal ParseDecimal(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Decimal
The parsed decimal value, 0 if the conversion fails. |
ParseDecimal(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a decimal value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static decimal ParseDecimal(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Decimal
The parsed decimal value, 0 if the conversion fails. |
ParseDecimal(IDataRecord, String)
Parses a decimal value from a column of type string using the name of the column.
Declaration
public static decimal ParseDecimal(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Decimal
The parsed decimal value, 0 if the conversion fails. |
ParseDecimal(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a decimal value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static decimal ParseDecimal(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Decimal
The parsed decimal value, 0 if the conversion fails. |
ParseDouble(IDataRecord, Int32)
Parses a double value from a column of type string using the index of the column.
Declaration
public static double ParseDouble(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Double
The parsed double value, 0 if the conversion fails. |
ParseDouble(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a double value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static double ParseDouble(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Double
The parsed double value, 0 if the conversion fails. |
ParseDouble(IDataRecord, String)
Parses a double value from a column of type string using the name of the column.
Declaration
public static double ParseDouble(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Double
The parsed double value, 0 if the conversion fails. |
ParseDouble(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a double value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static double ParseDouble(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Double
The parsed double value, 0 if the conversion fails. |
ParseInt(IDataRecord, Int32)
Parses an integer value from a column of type string using the index of the column.
Declaration
public static int ParseInt(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Int32
The parsed integer value, 0 if the conversion fails. |
ParseInt(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses an integer value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static int ParseInt(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Int32
The parsed integer value, 0 if the conversion fails. |
ParseInt(IDataRecord, String)
Parses an integer value from a column of type string using the name of the column.
Declaration
public static int ParseInt(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Int32
The parsed integer value, 0 if the conversion fails. |
ParseInt(IDataRecord, String, NumberStyles, IFormatProvider)
Parses an integer value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static int ParseInt(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Int32
The parsed integer value, 0 if the conversion fails. |
ParseLong(IDataRecord, Int32)
Parses a long value from a column of type string using the index of the column.
Declaration
public static long ParseLong(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Int64
The parsed long value, 0 if the conversion fails. |
ParseLong(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a long value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static long ParseLong(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Int64
The parsed long value, 0 if the conversion fails. |
ParseLong(IDataRecord, String)
Parses a long value from a column of type string using the name of the column.
Declaration
public static long ParseLong(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Int64
The parsed long value, 0 if the conversion fails. |
ParseLong(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a long value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static long ParseLong(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Int64
The parsed long value, 0 if the conversion fails. |
ParseNullableBoolean(IDataRecord, Int32)
Parses a boolean value from a column of type string using the index of the column.
Declaration
public static bool? ParseNullableBoolean(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Nullable<Boolean>
The parsed boolean value, null if the conversion fails. |
ParseNullableBoolean(IDataRecord, String)
Parses a boolean value from a column of type string using the name of the column.
Declaration
public static bool? ParseNullableBoolean(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get the value from. |
Returns
|
System.Nullable<Boolean>
The parsed boolean value, null if the conversion fails. |
ParseNullableDateTime(IDataRecord, Int32)
Parses a DateTime value from a column of type string using the index of the column.
Declaration
public static DateTime? ParseNullableDateTime(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDateTime(IDataRecord, Int32, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the index of the column, the culture-specific format information and the formatting style.
Declaration
public static DateTime? ParseNullableDateTime(this IDataRecord dataRecord, int index, IFormatProvider provider, DateTimeStyles styles)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
styles
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDateTime(IDataRecord, String)
Parses a DateTime value from a column of type string using the name of the column.
Declaration
public static DateTime? ParseNullableDateTime(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDateTime(IDataRecord, String, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the name of the column, the culture-specific format information and the formatting style.
Declaration
public static DateTime? ParseNullableDateTime(this IDataRecord dataRecord, string columnName, IFormatProvider provider, DateTimeStyles styles)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
styles
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDateTimeExact(IDataRecord, Int32, String, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the index of the column, the required format of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime? ParseNullableDateTimeExact(this IDataRecord dataRecord, int index, string format, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
String
format
The required format of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDateTimeExact(IDataRecord, Int32, String[], IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the index of the column, the allowed formats of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime? ParseNullableDateTimeExact(this IDataRecord dataRecord, int index, string[] formats, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
String[]
formats
An array of allowable formats of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDateTimeExact(IDataRecord, String, String, IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the name of the column, the required format of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime? ParseNullableDateTimeExact(this IDataRecord dataRecord, string columnName, string format, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
String
format
The required format of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDateTimeExact(IDataRecord, String, String[], IFormatProvider, DateTimeStyles)
Parses a DateTime value from a column of type string using the name of the column, the allowed formats of the string, the culture-specific format information and the formatting style.
Declaration
public static DateTime? ParseNullableDateTimeExact(this IDataRecord dataRecord, string columnName, string[] formats, IFormatProvider provider, DateTimeStyles style)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
String[]
formats
An array of allowable formats of the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
|
System.Globalization.DateTimeStyles
style
A bitwise combination of System.Globalization.DateTimeStyles that defines how to interpret the string value. |
Returns
|
System.Nullable<System.DateTime>
The parsed DateTime value, null if the conversion fails. |
ParseNullableDecimal(IDataRecord, Int32)
Parses a decimal value from a column of type string using the index of the column.
Declaration
public static decimal? ParseNullableDecimal(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Nullable<System.Decimal>
The parsed decimal value, null if the conversion fails. |
ParseNullableDecimal(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a decimal value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static decimal? ParseNullableDecimal(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Decimal>
The parsed decimal value, null if the conversion fails. |
ParseNullableDecimal(IDataRecord, String)
Parses a decimal value from a column of type string using the name of the column.
Declaration
public static decimal? ParseNullableDecimal(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Nullable<System.Decimal>
The parsed decimal value, null if the conversion fails. |
ParseNullableDecimal(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a decimal value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static decimal? ParseNullableDecimal(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Decimal>
The parsed decimal value, null if the conversion fails. |
ParseNullableDouble(IDataRecord, Int32)
Parses a double value from a column of type string using the index of the column.
Declaration
public static double? ParseNullableDouble(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Nullable<System.Double>
The parsed double value, null if the conversion fails. |
ParseNullableDouble(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a double value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static double? ParseNullableDouble(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Double>
The parsed double value, null if the conversion fails. |
ParseNullableDouble(IDataRecord, String)
Parses a double value from a column of type string using the name of the column.
Declaration
public static double? ParseNullableDouble(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Nullable<System.Double>
The parsed double value, null if the conversion fails. |
ParseNullableDouble(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a double value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static double? ParseNullableDouble(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Double>
The parsed double value, null if the conversion fails. |
ParseNullableInt(IDataRecord, Int32)
Parses an integer value from a column of type string using the index of the column.
Declaration
public static int? ParseNullableInt(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Nullable<System.Int32>
The parsed integer value, null if the conversion fails. |
ParseNullableInt(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses an integer value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static int? ParseNullableInt(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Int32>
The parsed integer value, null if the conversion fails. |
ParseNullableInt(IDataRecord, String)
Parses an integer value from a column of type string using the name of the column.
Declaration
public static int? ParseNullableInt(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Nullable<System.Int32>
The parsed integer value, null if the conversion fails. |
ParseNullableInt(IDataRecord, String, NumberStyles, IFormatProvider)
Parses an integer value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static int? ParseNullableInt(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Int32>
The parsed integer value, null if the conversion fails. |
ParseNullableLong(IDataRecord, Int32)
Parses a long value from a column of type string using the index of the column.
Declaration
public static long? ParseNullableLong(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Nullable<System.Int64>
The parsed long value, null if the conversion fails. |
ParseNullableLong(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a long value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static long? ParseNullableLong(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Int64>
The parsed long value, null if the conversion fails. |
ParseNullableLong(IDataRecord, String)
Parses a long value from a column of type string using the name of the column.
Declaration
public static long? ParseNullableLong(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Nullable<System.Int64>
The parsed long value, null if the conversion fails. |
ParseNullableLong(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a long value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static long? ParseNullableLong(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Int64>
The parsed long value, null if the conversion fails. |
ParseNullableShort(IDataRecord, Int32)
Parses a short value from a column of type string using the index of the column.
Declaration
public static short? ParseNullableShort(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Nullable<System.Int16>
The parsed short value, null if the conversion fails. |
ParseNullableShort(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a short value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static short? ParseNullableShort(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Int16>
The short long value, null if the conversion fails. |
ParseNullableShort(IDataRecord, String)
Parses a short value from a column of type string using the name of the column.
Declaration
public static short? ParseNullableShort(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Nullable<System.Int16>
The parsed short value, null if the conversion fails. |
ParseNullableShort(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a short value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static short? ParseNullableShort(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Nullable<System.Int16>
The short long value, null if the conversion fails. |
ParsePersonnummer(IDataRecord, Int32)
Parses a column as a swedish social security number.
Declaration
public static string ParsePersonnummer(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
String
A formated ([YY]YYMMDD-XXXX) swedish social security number. |
ParseShort(IDataRecord, Int32)
Parses a short value from a column of type string using the index of the column.
Declaration
public static short ParseShort(this IDataRecord dataRecord, int index)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
Returns
|
System.Int16
The parsed short value, 0 if the conversion fails. |
ParseShort(IDataRecord, Int32, NumberStyles, IFormatProvider)
Parses a short value from a column of type string using the index of the column, the formatting style and the culture-specific format.
Declaration
public static short ParseShort(this IDataRecord dataRecord, int index, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
System.Int32
index
The index of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Int16
The short long value, 0 if the conversion fails. |
ParseShort(IDataRecord, String)
Parses a short value from a column of type string using the name of the column.
Declaration
public static short ParseShort(this IDataRecord dataRecord, string columnName)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
Returns
|
System.Int16
The parsed short value, 0 if the conversion fails. |
ParseShort(IDataRecord, String, NumberStyles, IFormatProvider)
Parses a short value from a column of type string using the name of the column, the formatting style and the culture-specific format.
Declaration
public static short ParseShort(this IDataRecord dataRecord, string columnName, NumberStyles style, IFormatProvider provider)
Parameters
|
System.Data.IDataRecord
dataRecord
The System.Data.IDataRecord to get the value from. |
|
String
columnName
The name of the column to get value from. |
|
System.Globalization.NumberStyles
style
A bitwise combination of System.Globalization.NumberStyles that indicates the permitted format the string value. |
|
System.IFormatProvider
provider
An System.IFormatProvider object that supplies culture-specific formatting information about the string value. |
Returns
|
System.Int16
The short long value, 0 if the conversion fails. |