TypeDescriptor.GetComponentName Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
- GetComponentName()
- GetClassName
- GetFullComponentName(Object)
- CreateInstance(IServiceProvider, Type, Type[], Object[])
- GetReflectionType
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
- 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
- GetComponentName()
- ICustomTypeDescriptor
- GetClassName
- GetFullComponentName(Object)
- CreateInstance(IServiceProvider, Type, Type[], Object[])
- GetReflectionType