UriTypeConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定义

返回该转换器是否可以将给定类型的对象转换为此转换器的类型。Returns whether this converter can convert an object of the given type to the type of this converter.

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

参数

context
ITypeDescriptorContext

一个 ITypeDescriptorContext,用于提供格式上下文。An ITypeDescriptorContext that provides a format context.

sourceType
Type

一个 Type,表示要转换的类型。A Type that represents the type that you want to convert from.

返回

如果 truesourceType 类型,或者可以从 String 分配 Uri 类型,则为 sourceType;否则为 falsetrue if sourceType is a String type or a Uri type can be assigned from sourceType; otherwise, false.

例外

sourceType 参数为 nullThe sourceType parameter is null.

适用于