KeysConverter.CanConvertTo(ITypeDescriptorContext, Type) Method

Definition

Returns a value indicating whether this converter can convert an object in the specified source type to the native type of the converter using the specified context.

C#
public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, Type destinationType);
C#
public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, Type? destinationType);

Parameters

context
ITypeDescriptorContext

An ITypeDescriptorContext that provides a format context, which can be used to extract additional information about the environment this converter is being invoked from. This parameter or properties of this parameter can be null.

destinationType
Type

The Type to convert to.

Returns

true if the conversion can be performed; otherwise, false.

Remarks

The CanConvertTo method is specialized to return true if the destinationType parameter is of type Enum array; otherwise, it defers evaluation to the base implementation of this method.

Notes to Inheritors

Override this method to provide your own conversion requirements.

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

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also