DBNull.IConvertible.ToType Method
This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Converts the current DBNull object to the specified type.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Private Function ToType ( _ type As Type, _ provider As IFormatProvider _ ) As Object Implements IConvertible.ToType
Parameters
- type
- Type: System.Type
The type to convert the current DBNull object to.
- provider
- Type: System.IFormatProvider
An object that implements the IFormatProvider interface and is used to augment the conversion. If Nothing is specified, format information is obtained from the current culture.
Return Value
Type: System.ObjectThe boxed equivalent of the current DBNull object, if that conversion is supported; otherwise, an exception is thrown and no value is returned.
Implements
IConvertible.ToType(Type, IFormatProvider)| Exception | Condition |
|---|---|
| InvalidCastException | This conversion is not supported for the DBNull type. |
| ArgumentNullException | type is Nothing. |
Show: