DBNull.IConvertible.ToType(Type, IFormatProvider) 方法
定义
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
参数
- provider
- IFormatProvider
用于实现 IFormatProvider 接口和增强转换的对象。An object that implements the IFormatProvider interface and is used to augment the conversion. 如果指定了 null,则从当前区域获得格式信息。If null is specified, format information is obtained from the current culture.
返回
如果支持这种转换,则返回当前 DBNull 对象的等效装箱项;否则将引发异常,并且不返回任何值。The boxed equivalent of the current DBNull object, if that conversion is supported; otherwise, an exception is thrown and no value is returned.
实现
例外
type 为 null。type is null.
注解
支持三种转换:如果 type 参数指定 Object 或,则 DBNull 返回值为当前的 DBNull 对象本身。Three conversions are supported: If the type parameter specifies Object or DBNull, the return value is the current DBNull object itself. 如果 type 参数指定 String ,则返回值为方法返回的字符串 ToString 。If the type parameter specifies String, the return value is the string returned by the ToString method.