KeysConverter.CanConvertTo(ITypeDescriptorContext, Type) 方法

定義

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

public:
 override bool CanConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ destinationType);
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

參數

context
ITypeDescriptorContext

ITypeDescriptorContext,提供格式內容,可以用來擷取與正在叫用此轉換子之環境有關的其他資訊。 這個參數或這個參數的屬性可為 null

destinationType
Type

要進行轉換的目的 Type

傳回

Boolean

如果轉換動作可以進行,則為 true,否則為 false

備註

如果 destinationType 參數的類型為 Enum 陣列,此方法 CanConvertTo 會特製化傳回 true ;否則,它會將評估延遲至此方法的基底實作。

給繼承者的注意事項

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

內容可用來擷取此轉換程式所叫用環境的其他資訊。 這可能是 null,所以您要隨時檢查。 此外,內容物件上的屬性也可能會傳回 null

適用於

另請參閱