Edit

Bagikan melalui


DateTime.IConvertible.ToType(Type, IFormatProvider) Method

Definition

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

Parameters

type
Type

The desired type.

provider
IFormatProvider

An object that implements the IFormatProvider interface. (This parameter is not used; specify null.)

Returns

An object of the type specified by the type parameter, with a value equivalent to the current DateTime object.

Implements

Exceptions

type is null.

This conversion is not supported for the DateTime type.

Applies to

See also