DateTime.IConvertible.ToType(Type, IFormatProvider) 方法

定义

将当前 DateTime 对象转换为指定类型的对象。Converts the current DateTime object to an object of a 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

参数

type
Type

所需类型。The desired type.

provider
IFormatProvider

一个实现 IFormatProvider 接口的对象。An object that implements the IFormatProvider interface. (未使用此参数;指定 null。)(This parameter is not used; specify null.)

返回

Object

type 参数指定的类型的对象,其值与当前 DateTime 对象等效。An object of the type specified by the type parameter, with a value equivalent to the current DateTime object.

实现

例外

typenulltype is null.

DateTime 类型不支持此转换。This conversion is not supported for the DateTime type.

适用于

另请参阅