TypeConverter.CanConvertTo TypeConverter.CanConvertTo TypeConverter.CanConvertTo TypeConverter.CanConvertTo Method

Definition

Returns whether this converter can convert the object to the specified type.

Overloads

CanConvertTo(Type) CanConvertTo(Type) CanConvertTo(Type) CanConvertTo(Type)

Returns whether this converter can convert the object to the specified type.

CanConvertTo(ITypeDescriptorContext, Type) CanConvertTo(ITypeDescriptorContext, Type) CanConvertTo(ITypeDescriptorContext, Type) CanConvertTo(ITypeDescriptorContext, Type)

Returns whether this converter can convert the object to the specified type, using the specified context.

CanConvertTo(Type) CanConvertTo(Type) CanConvertTo(Type) CanConvertTo(Type)

Returns whether this converter can convert the object to the specified type.

public:
 bool CanConvertTo(Type ^ destinationType);
[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public bool CanConvertTo (Type destinationType);
member this.CanConvertTo : Type -> bool
Public Function CanConvertTo (destinationType As Type) As Boolean
Parameters
destinationType
Type Type Type Type

A Type that represents the type you want to convert to.

Returns

true if this converter can perform the conversion; otherwise, false.

Remarks

If destinationType is a string, the default implementation of CanConvertTo always returns true.

CanConvertTo(ITypeDescriptorContext, Type) CanConvertTo(ITypeDescriptorContext, Type) CanConvertTo(ITypeDescriptorContext, Type) CanConvertTo(ITypeDescriptorContext, Type)

Returns whether this converter can convert the object to the specified type, using the specified context.

public:
 virtual bool CanConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ destinationType);
public virtual bool CanConvertTo (System.ComponentModel.ITypeDescriptorContext context, Type destinationType);
abstract member CanConvertTo : System.ComponentModel.ITypeDescriptorContext * Type -> bool
override this.CanConvertTo : System.ComponentModel.ITypeDescriptorContext * Type -> bool
Public Overridable Function CanConvertTo (context As ITypeDescriptorContext, destinationType As Type) As Boolean
Parameters
destinationType
Type Type Type Type

A Type that represents the type you want to convert to.

Returns

true if this converter can perform the conversion; otherwise, false.

Remarks

Use the context parameter to extract additional information about the environment from which this converter is invoked. This parameter can be null, so always check it. Also, properties on the context object can return null.

If destinationType is a string, the default implementation of CanConvertTo always returns true.

Notes to Inheritors

Override this method to provide your own conversion requirements.

See Also

Applies to