NullableTypes Class Library

DBNullConvert.ToNullableDecimal Method 

Converts an object value that is DBNull or System.Decimal to an equivalent NullableDecimal value.

[Visual Basic]
Public Shared Function ToNullableDecimal( _
   ByVal x As Object _
) As NullableDecimal
[C#]
public static NullableDecimal ToNullableDecimal(
   object x
);

Parameters

x
A value of Decimal type from either a DataRow Item value, a Parameters Item value or a IDataRecord GetValue returned value.

Return Value

Null if x is DBNull otherwise a NullableDecimal constructed from x.

Exceptions

Exception TypeCondition
ArgumentNullExceptionx is null.
InvalidCastExceptionx is neither DBNull or of type Decimal.

See Also

DBNullConvert Class | NullableTypes.HelperFunctions Namespace