Converts the given object to another type.
[Visual Basic] Overloads Overridable Public Function ConvertTo( _ ByVal context As ITypeDescriptorContext, _ ByVal value As Object, _ ByVal destinationType As Type, _ ByVal arguments() As Object _ ) As Object [C#] public virtual object ConvertTo( ITypeDescriptorContext context, object value, Type destinationType, object[] arguments ); [C++] public: virtual Object* ConvertTo( ITypeDescriptorContext* context, Object* value, Type* destinationType, Object* arguments[] ); [JScript] public function ConvertTo( context : ITypeDescriptorContext, value : Object, destinationType : Type, arguments : Object[] ) : Object;
The converted object.
Exception Type | Condition |
---|---|
NotSupportedException | The conversion could not be performed. |
The most common types to convert are to and from a string object. The default implementation will make a call to ToString on the object if the object is valid and if the destination type is string.
The context can be used to extract additional information about the environment this converter is being invoked from. This may be a null reference (in Visual Basic Nothing), so you should always check. Also, properties on the context object may also return a null reference (Nothing).
TypeConverter Class | TypeConverter Members | System.ComponentModel Namespace | TypeConverter.ConvertTo Overload List | ITypeDescriptorContext