DataMemberConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定义

获取一个值,它指示指定的源类型是否可使用指定的上下文和类型转换为关联控件属性的类型。Gets a value indicating whether the specified source type can be converted to the type of the associated control property using the specified context and type. 此 API 已废弃不用。This API is obsolete. 若要了解如何开发 ASP.NET 移动应用,请参阅 Mobile Apps & Sites with ASP.NET (ASP.NET 移动应用和网站)。For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

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 represents the data-bound component or the control that the property belongs to.

sourceType
Type

要转换的类型。The type to convert from.

返回

Boolean

如果 sourceTypeString,则为 true;否则为 falsetrue if the sourceType is String; otherwise false.

注解

备注

通常不会直接访问类型转换器。You typically do not access a type converter directly. 的此实现用于 TypeConverter 设计时的数据绑定控件,并使用属性对其进行实例化 TypeConverterAttributeThis implementation of TypeConverter is intended for use by a data bound control at design time, and instantiated with a TypeConverterAttribute on a property.

适用于

另请参阅