TypeDescriptor.GetDefaultProperty Method

Definition

Returns the default property for a component.

Overloads

GetDefaultProperty(Object, Boolean)

Returns the default property for the specified component with a custom type descriptor.

GetDefaultProperty(Object)

Returns the default property for the specified component.

GetDefaultProperty(Type)

Returns the default property for the specified type of component.

GetDefaultProperty(Object, Boolean)

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

Returns the default property for the specified component with a custom type descriptor.

C#
public static System.ComponentModel.PropertyDescriptor? GetDefaultProperty(object component, bool noCustomTypeDesc);
C#
public static System.ComponentModel.PropertyDescriptor GetDefaultProperty(object component, bool noCustomTypeDesc);

Parameters

component
Object

The component to get the default property for.

noCustomTypeDesc
Boolean

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

Returns

A PropertyDescriptor with the default property, or null if there are no properties.

Exceptions

component is a cross-process remoted object.

Remarks

If the component parameter is null, this method returns null.

See also

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.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, 10
.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, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

GetDefaultProperty(Object)

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

Returns the default property for the specified component.

C#
public static System.ComponentModel.PropertyDescriptor? GetDefaultProperty(object component);
C#
public static System.ComponentModel.PropertyDescriptor GetDefaultProperty(object component);

Parameters

component
Object

The component to get the default property for.

Returns

A PropertyDescriptor with the default property, or null if there are no properties.

Exceptions

component is a cross-process remoted object.

Remarks

If the component parameter is null, this method returns null.

See also

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.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, 10
.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, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

GetDefaultProperty(Type)

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

Returns the default property for the specified type of component.

C#
public static System.ComponentModel.PropertyDescriptor? GetDefaultProperty(Type componentType);
C#
public static System.ComponentModel.PropertyDescriptor GetDefaultProperty(Type componentType);

Parameters

componentType
Type

A Type that represents the class to get the property for.

Returns

A PropertyDescriptor with the default property, or null if there are no properties.

Remarks

Call this version of this method only when you do not have an instance of the object.

If the componentType parameter is null, this method returns null.

See also

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.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, 10
.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, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1