NullableTypes Class Library

DBNullConvert.ToNullableInt16 Method 

Converts an object value that is DBNull or System.Int16 to an equivalent NullableInt16 value.

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

Parameters

x
A value of Int16 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 NullableInt16 constructed from x.

Exceptions

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

See Also

DBNullConvert Class | NullableTypes.HelperFunctions Namespace