NullableTypes Class Library

DBNullConvert.ToNullableInt32 Method 

Converts an object value that is DBNull or System.Int32 to an equivalent NullableInt32 value.

[Visual Basic]
Public Shared Function ToNullableInt32( _
   ByVal x As Object _
) As NullableInt32
public static NullableInt32 ToNullableInt32(
   object x


A value of Int32 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 NullableInt32 constructed from x.


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

See Also

DBNullConvert Class | NullableTypes.HelperFunctions Namespace