SizeConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定義

判斷這個轉換子是否可以將指定來源型別的物件轉換成轉換子的原生 (Native) 型別。Determines whether this converter can convert an object in the specified source type to the native type of the 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 可用來取得環境的其他資訊,而這個轉換子就是從這個環境呼叫的。A ITypeDescriptorContext that can be used to get additional information about the environment this converter is being called from. 這可能是 null,所以您要隨時檢查。This may be null, so you should always check. 此外,內容物件上的屬性也可能會傳回 nullAlso, properties on the context object may also return null.

sourceType
Type

要轉換的來源型別。The type you want to convert from.

傳回

如果這個物件可以執行轉換,則這個方法會傳回 trueThis method returns true if this object can perform the conversion.

適用於