NullableTypes Class Library

DBNullConvert.ToNullableByte Method 

Converts an object value that is DBNull or System.Byte to an equivalent NullableByte value.

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

Parameters

x
A value of Byte 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 NullableByte constructed from x.

Exceptions

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

See Also

DBNullConvert Class | NullableTypes.HelperFunctions Namespace