DateTime::IConvertible::ToType Method (Type^, IFormatProvider^)
This API supports the product infrastructure and is not intended to be used directly from your code.
Converts the current DateTime object to an object of a specified type.
Assembly: mscorlib (in mscorlib.dll)
private: virtual Object^ ToType( Type^ type, IFormatProvider^ provider ) sealed = IConvertible::ToType
Parameters
- type
-
Type:
System::Type^
The desired type.
- provider
-
Type:
System::IFormatProvider^
An object that implements the IFormatProvider interface. (This parameter is not used; specify null.)
Return Value
Type: System::Object^An object of the type specified by the type parameter, with a value equivalent to the current DateTime object.
| Exception | Condition |
|---|---|
| ArgumentNullException | type is null. |
| InvalidCastException | This conversion is not supported for the DateTime type. |
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0