SelectionRangeConverter.CanConvertTo Method (ITypeDescriptorContext, Type)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets a value indicating whether this converter can convert an object to the specified destination type by using the specified context.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public override bool CanConvertTo(
	ITypeDescriptorContext context,
	Type destinationType


Type: System.ComponentModel.ITypeDescriptorContext

A ITypeDescriptorContext that provides a format context.

Type: System.Type

The destination Type to convert into.

Return Value

Type: System.Boolean

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

The CanConvertTo method returns true if the destinationType parameter is of type String or InstanceDescriptor. Otherwise, it defers the call to the base implementation of this method, TypeConverter.CanConvertTo(ITypeDescriptorContext, Type).

Notes to Inheritors:

Override this method to provide your own conversion requirements.

The context parameter can be used to extract additional information about the environment this converter is being invoked from. The parameter may be null, so you should always verify the information. Also, properties on the context object may also return null.

.NET Framework
Available since 1.1
Return to top