OpacityConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定義

傳回值,指出這個轉換子是否可以使用指定的內容,將指定之來源型別的物件轉換成轉換子的原生型別。

public:
 override bool CanConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ sourceType);
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,提供關於型別轉換內容的詳細資訊。

sourceType
Type

Type,表示要轉換的來源型別。

傳回

如果這個轉換子可以執行轉換,則為 true,否則為 false

備註

sourceType必須是 String

給繼承者的注意事項

請覆寫這個方法以提供您自己的轉換需求。

您可以使用 context 參數來擷取叫用此轉換程式所叫用環境的其他資訊。 參數可能是 null ,因此您應該一律驗證內容。 此外,上的 ITypeDescriptorContext 屬性也可能傳回 null

適用於

另請參閱