PointConverter.CanConvertTo(ITypeDescriptorContext, Type) Method

Definition

获取一个值,该值指示此转换器能否使用上下文将对象转换为给定的目标类型。Gets a value indicating whether this converter can convert an object to the given destination type using the context.

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

Parameters

context
ITypeDescriptorContext

一个提供格式上下文的 ITypeDescriptorContext 对象。An ITypeDescriptorContext object that provides a format context.

destinationType
Type

Type 对象,它表示您希望转换为的类型。A Type object that represents the type you want to convert to.

Returns

Boolean

如果此转换器可以执行转换,则为 true;否则为 falsetrue if this converter can perform the conversion; otherwise, false.

Remarks

context 参数可用于获取有关从中调用此转换器的环境的其他信息。The context parameter can be used to get additional information about the environment this converter is being called from. 这可能为 null,因此应总是对其进行检查。This can be null, so you should always check. 同样,上下文对象上的属性也可能 nullAlso, properties on the context object can also return null.

Applies to