Bewerken

Share via


DBNull.IConvertible.ToType(Type, IFormatProvider) Method

Definition

Converts the current DBNull object to the specified type.

 virtual System::Object ^ System.IConvertible.ToType(Type ^ type, IFormatProvider ^ provider) = IConvertible::ToType;
object IConvertible.ToType (Type type, IFormatProvider provider);
abstract member System.IConvertible.ToType : Type * IFormatProvider -> obj
override this.System.IConvertible.ToType : Type * IFormatProvider -> obj
Function ToType (type As Type, provider As IFormatProvider) As Object Implements IConvertible.ToType

Parameters

type
Type

The type to convert the current DBNull object to.

provider
IFormatProvider

An object that implements the IFormatProvider interface and is used to augment the conversion. If null is specified, format information is obtained from the current culture.

Returns

The boxed equivalent of the current DBNull object, if that conversion is supported; otherwise, an exception is thrown and no value is returned.

Implements

Exceptions

This conversion is not supported for the DBNull type.

type is null.

Remarks

Three conversions are supported: If the type parameter specifies Object or DBNull, the return value is the current DBNull object itself. If the type parameter specifies String, the return value is the string returned by the ToString method.

Applies to

See also