TypeDescriptor.GetClassName 方法

定義

傳回指定元件之類別的名稱。

多載

GetClassName(Object)

傳回使用預設類型描述元之指定元件的類別名稱。

GetClassName(Type)

傳回指定類型之類別的名稱。

GetClassName(Object, Boolean)

傳回使用自訂類型描述元之指定元件的類別名稱。

GetClassName(Object)

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

傳回使用預設類型描述元之指定元件的類別名稱。

public:
 static System::String ^ GetClassName(System::Object ^ component);
public static string GetClassName (object component);
public static string? GetClassName (object component);
static member GetClassName : obj -> string
Public Shared Function GetClassName (component As Object) As String

參數

component
Object

需要類別名稱的 Object

傳回

String,包含指定元件的類別名稱。

例外狀況

componentnull

備註

一般而言,這個方法會傳 component 回參數類型的完整 Type 名稱。 例如,按鈕的類別名稱是 「System.Windows.Forms.Button」。 如果 component 實作 ICustomTypeDescriptor ,它可以傳回替代名稱。

這個方法相當於具有 第二個參數 false 的多載 GetClassName(Object, Boolean) 方法。

另請參閱

適用於

GetClassName(Type)

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

傳回指定類型之類別的名稱。

public:
 static System::String ^ GetClassName(Type ^ componentType);
public static string GetClassName (Type componentType);
public static string? GetClassName (Type componentType);
static member GetClassName : Type -> string
Public Shared Function GetClassName (componentType As Type) As String

參數

componentType
Type

目標元件的 Type

傳回

String,包含指定元件類型之類別的名稱。

例外狀況

componentTypenull

備註

這個方法會針對指定的型別使用快取的自訂型別描述元來探索相關聯的類別名稱。

另請參閱

適用於

GetClassName(Object, Boolean)

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

傳回使用自訂類型描述元之指定元件的類別名稱。

public:
 static System::String ^ GetClassName(System::Object ^ component, bool noCustomTypeDesc);
public static string GetClassName (object component, bool noCustomTypeDesc);
public static string? GetClassName (object component, bool noCustomTypeDesc);
static member GetClassName : obj * bool -> string
Public Shared Function GetClassName (component As Object, noCustomTypeDesc As Boolean) As String

參數

component
Object

需要類別名稱的 Object

noCustomTypeDesc
Boolean

true 表示不考慮自訂類型描述資訊,否則為 false

傳回

String,包含指定元件的類別名稱。

例外狀況

componentnull

component 是跨處理序的遠端物件。

備註

一般而言,這個方法會傳 component 回參數類型的完整 Type 名稱。 例如,按鈕的類別名稱是 「System.Windows.Forms.Button」。 component如果參數實作 ICustomTypeDescriptor ,它可以傳回替代名稱。

另請參閱

適用於