共用方式為


LowerCaseStringConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定義

判斷是否可以依據指定的參數將物件轉換為小寫字串。

public:
 override bool CanConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ ctx, Type ^ type);
public override bool CanConvertFrom (System.ComponentModel.ITypeDescriptorContext ctx, Type type);
override this.CanConvertFrom : System.ComponentModel.ITypeDescriptorContext * Type -> bool
Public Overrides Function CanConvertFrom (ctx As ITypeDescriptorContext, type As Type) As Boolean

參數

ctx
ITypeDescriptorContext

實作 ITypeDescriptorContext 介面的物件。

type
Type

要轉換的物件型別。

傳回

如果參數描述可以將物件轉換為小寫字串物件則為 true,否則為 false

範例

下列範例示範如何使用這個方法。

// CanConvertFrom method.
Console.WriteLine("CanConvertFrom: {0}",
  myLCStrConverter.CanConvertFrom(ctx, testStrVal.GetType()));
' CanConvertFrom method.
Console.WriteLine("CanConvertFrom: {0}", _
  myLCStrConverter.CanConvertFrom(ctx, testStrVal.GetType()))

備註

這個方法會使用 實作 ITypeDescriptorContext 介面做為 ctx 參數的物件。 此介面提供有關元件的內容資訊。 一般而言,此介面會在設計階段用來提供設計階段容器的相關資訊。 ITypeDescriptorContext通常用於型別轉換。 如果需要自訂行為,請在衍生類別中覆寫這個方法。

適用於

另請參閱