Boolean.IConvertible.ToType(Type, IFormatProvider) Method

Definition

有关此成员的说明,请参见 ToType(Type, IFormatProvider)For a description of this member, see 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

Parameters

type
Type

所需类型。The desired type.

provider
IFormatProvider

一个 IFormatProvider 实现,提供有关返回值格式的区域性特定信息。An IFormatProvider implementation that supplies culture-specific information about the format of the returned value.

Returns

Object

一个指定类型的对象,其值与此 Boolean 对象的值相等。An object of the specified type, with a value that is equivalent to the value of this Boolean object.

Implements

Exceptions

typenulltype is null.

不支持请求的类型转换。The requested type conversion is not supported.

Remarks

此成员是显式接口成员实现。This member is an explicit interface member implementation. 它只能在 Boolean 实例被强制转换为 IConvertible 接口时使用。It can be used only when the Boolean instance is cast to an IConvertible interface. 建议的替代项是调用 Convert.ChangeType 方法。The recommended alternative is to call the Convert.ChangeType method.

Applies to

See also