NullableTypes Class Library

DBNullConvert.ToNullableString Method 

Converts an object value that is DBNull or System.String to an equivalent NullableString value.

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

Parameters

x
A value of String 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 NullableString constructed from x.

Exceptions

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

See Also

DBNullConvert Class | NullableTypes.HelperFunctions Namespace