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 string GetClassName (object component);
public static string? GetClassName (object component);

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

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0, 2.1

GetClassName(Type)

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

Returns the name of the class for the specified type.

public static string GetClassName (Type componentType);
public static string? GetClassName (Type componentType);

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

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0, 2.1

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 string GetClassName (object component, bool noCustomTypeDesc);
public static string? GetClassName (object component, bool noCustomTypeDesc);

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

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0, 2.1