CommandConverter.ConvertTo 方法

定義

使用指定的內容,嘗試將 ICommand 轉換為指定的型別。

public:
 override System::Object ^ ConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value, Type ^ destinationType);
public override object ConvertTo (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType);
override this.ConvertTo : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj * Type -> obj
Public Overrides Function ConvertTo (context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object

參數

context
ITypeDescriptorContext

格式內容,提供正在叫用此轉換器之環境的相關資訊。

culture
CultureInfo

特定文化特性 (Culture) 資訊。

value
Object

要轉換的物件。

destinationType
Type

要將物件轉換成的類型。

傳回

轉換的物件,或是空字串。

例外狀況

destinationTypenull

無法轉換 value

備註

CommandConverter 類別只會在 ICommand 的執行個體和 String 之間來回轉換。 只能傳回現有的 (非自定義) 命令。

適用於