TypeDescriptor.GetDefaultEvent Method

Definition

Returns the default event for a component or type.

Overloads

GetDefaultEvent(Object)

Returns the default event for the specified component.

GetDefaultEvent(Type)

Returns the default event for the specified type of component.

GetDefaultEvent(Object, Boolean)

Returns the default event for a component with a custom type descriptor.

GetDefaultEvent(Object)

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

Returns the default event for the specified component.

C#
public static System.ComponentModel.EventDescriptor GetDefaultEvent(object component);
C#
public static System.ComponentModel.EventDescriptor? GetDefaultEvent(object component);

Parameters

component
Object

The component to get the event for.

Returns

An EventDescriptor with the default event, or null if there are no events.

Exceptions

component is null.

component is a cross-process remoted object.

Remarks

This method is equivalent to the overloaded GetDefaultEvent(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

GetDefaultEvent(Type)

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

Returns the default event for the specified type of component.

C#
public static System.ComponentModel.EventDescriptor GetDefaultEvent(Type componentType);
C#
public static System.ComponentModel.EventDescriptor? GetDefaultEvent(Type componentType);

Parameters

componentType
Type

The Type of the target component.

Returns

An EventDescriptor with the default event, or null if there are no events.

Exceptions

componentType is null.

Remarks

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

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

GetDefaultEvent(Object, Boolean)

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

Returns the default event for a component with a custom type descriptor.

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

Parameters

component
Object

The component to get the event for.

noCustomTypeDesc
Boolean

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

Returns

An EventDescriptor with the default event, or null if there are no events.

Exceptions

component is null.

component is a cross-process remoted object.

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