Redigera

Dela via


TypeDescriptor.GetComponentName Method

Definition

Returns the name of the specified component.

Overloads

GetComponentName(Object)

Returns the name of the specified component using the default type descriptor.

GetComponentName(Object, Boolean)

Returns the name of the specified component using a custom type descriptor.

GetComponentName(Object)

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

Returns the name of the specified component using the default type descriptor.

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

Parameters

component
Object

The Object for which you want the class name.

Returns

A String containing the name of the specified component, or null if there is no component name.

Exceptions

component is null.

component is a cross-process remoted object.

Remarks

Typically, this method returns the name for the site of the component, if one exists. For example, the class name for a button is "System.Windows.Forms.Button".

This method is equivalent to the overloaded GetComponentName(Object, Boolean) method with a second parameter of false.

This method is used at design time to retrieve the name of an instance of a component.

See also

Applies to

GetComponentName(Object, Boolean)

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

Returns the name of the specified component using a custom type descriptor.

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

Parameters

component
Object

The Object for which you want the class name.

noCustomTypeDesc
Boolean

true to not consider custom type description information; otherwise, false.

Returns

The name of the class for the specified component, or null if there is no component name.

Exceptions

component is null.

component is a cross-process remoted object.

Remarks

This method is used at design time to retrieve the name of an instance of a component. Typically, this method returns the name for the site of the component, if one exists. For example, the class name for a button is "System.Windows.Forms.Button". If the component implements the ICustomTypeDescriptor interface, it can return an alternate name.

See also

Applies to