语言

TypeDescriptor.GetComponentName 方法

定义

返回指定组件的名称。

重载

名称 说明
GetComponentName(Object)

使用默认类型描述符返回指定组件的名称。

GetComponentName(Object, Boolean)

使用自定义类型描述符返回指定组件的名称。

GetComponentName(Object)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

使用默认类型描述符返回指定组件的名称。

public:
 static System::String ^ GetComponentName(System::Object ^ component);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")]
public static string? GetComponentName(object component);
public static string GetComponentName(object component);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")>]
static member GetComponentName : obj -> string
static member GetComponentName : obj -> string
Public Shared Function GetComponentName (component As Object) As String

参数

component
Object

Object要为其指定类名的类名。

返回

一个 String 包含指定组件的名称,或者 null 如果没有组件名称。

属性

例外

component 是 null。

component 是一个跨进程远程对象。

注解

通常,此方法返回组件站点的名称(如果存在)。 例如,按钮的类名称为“系统”。Windows。Forms.Button”。

此方法等效于具有第二个参数的GetComponentName(Object, Boolean)重载false方法。

此方法在设计时用于检索组件实例的名称。

另请参阅

适用于

GetComponentName(Object, Boolean)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

使用自定义类型描述符返回指定组件的名称。

public:
 static System::String ^ GetComponentName(System::Object ^ component, bool noCustomTypeDesc);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")]
public static string? GetComponentName(object component, bool noCustomTypeDesc);
public static string GetComponentName(object component, bool noCustomTypeDesc);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")>]
static member GetComponentName : obj * bool -> string
static member GetComponentName : obj * bool -> string
Public Shared Function GetComponentName (component As Object, noCustomTypeDesc As Boolean) As String

参数

component
Object

Object要为其指定类名的类名。

noCustomTypeDesc
Boolean

true (不考虑自定义类型说明信息);否则,为 false.

返回

指定组件 null 或不存在组件名称的类的名称。

属性

例外

component 是 null。

component 是一个跨进程远程对象。

注解

此方法在设计时用于检索组件实例的名称。 通常,此方法返回组件站点的名称(如果存在)。 例如,按钮的类名称为“系统”。Windows。Forms.Button”。 如果组件实现 ICustomTypeDescriptor 接口,它可以返回备用名称。

另请参阅

适用于