Редактиране

Споделяне чрез


TypeDescriptor.GetClassName Method

Definition

Returns the name of the class for the specified component.

Overloads

GetClassName(Object)

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

GetClassName(Type)

Returns the name of the class for the specified type.

GetClassName(Object, Boolean)

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

GetClassName(Object)

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

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

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

Parameters

component
Object

The Object for which you want the class name.

Returns

A String containing the name of the class for the specified component.

Exceptions

component is null.

Remarks

Typically, this method returns the full Type name for the component parameter type. For example, the class name for a button is "System.Windows.Forms.Button". If component implements ICustomTypeDescriptor, it can return an alternate name.

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

See also

Applies to

GetClassName(Type)

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

Returns the name of the class for the specified type.

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

Parameters

componentType
Type

The Type of the target component.

Returns

A String containing the name of the class for the specified component type.

Exceptions

componentType is null.

Remarks

This method uses the cached custom type descriptor for the specified type to discover the associated class name.

See also

Applies to

GetClassName(Object, Boolean)

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

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

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

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

A String containing the name of the class for the specified component.

Exceptions

component is null.

component is a cross-process remoted object.

Remarks

Typically, this method returns the full Type name for the component parameter type. For example, the class name for a button is "System.Windows.Forms.Button". If the component parameter implements ICustomTypeDescriptor, it can return an alternate name.

See also

Applies to