Calls the appropriate method, depending on the specified type.
[Visual Basic] Overridable Public Function ToType( _ ByVal type As Type _ ) As Object [C#] public virtual object ToType( Type type ); [C++] public: virtual Object* ToType( Type* type ); [JScript] public function ToType( type : Type ) : Object;
None, but the return value is typed the same as type.
Exception Type | Condition |
---|---|
InvalidCastException | (Always thrown.) |
The following table specifies the method called based on the Type of the type parameter.
Method called | Type
of |
---|---|
ToBoolean | bool |
ToChar | char |
ToSByte | sbyte |
ToByte | byte |
ToInt16 | short |
ToUInt16 | ushort |
ToInt32 | int |
ToUInt32 | uint |
ToInt64 | long |
ToUInt64 | ulong |
ToSingle | float |
ToDouble | Double |
ToDecimal | Decimal |
ToDateTime | DateTime |