EventDescriptorCollection Constructors

Definition

Initializes a new instance of the EventDescriptorCollection class.

Overloads

EventDescriptorCollection(EventDescriptor[])

Initializes a new instance of the EventDescriptorCollection class with the given array of EventDescriptor objects.

EventDescriptorCollection(EventDescriptor[], Boolean)

Initializes a new instance of the EventDescriptorCollection class with the given array of EventDescriptor objects. The collection is optionally read-only.

EventDescriptorCollection(EventDescriptor[])

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

Initializes a new instance of the EventDescriptorCollection class with the given array of EventDescriptor objects.

C#
public EventDescriptorCollection(System.ComponentModel.EventDescriptor[]? events);
C#
public EventDescriptorCollection(System.ComponentModel.EventDescriptor[] events);

Parameters

events
EventDescriptor[]

An array of type EventDescriptor that provides the events for this collection.

Examples

The following code example creates a new EventDescriptorCollection class using the events on button1. It requires that button1 has been instantiated on a form.

C#
EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);

Remarks

If the events parameter is empty, this constructor creates an empty EventDescriptorCollection class.

The HostProtectionAttribute attribute applied to this member has the following Resources property value: Synchronization. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

See also

Applies to

.NET 10 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, 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

EventDescriptorCollection(EventDescriptor[], Boolean)

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

Initializes a new instance of the EventDescriptorCollection class with the given array of EventDescriptor objects. The collection is optionally read-only.

C#
public EventDescriptorCollection(System.ComponentModel.EventDescriptor[]? events, bool readOnly);
C#
public EventDescriptorCollection(System.ComponentModel.EventDescriptor[] events, bool readOnly);

Parameters

events
EventDescriptor[]

An array of type EventDescriptor that provides the events for this collection.

readOnly
Boolean

true to specify a read-only collection; otherwise, false.

Examples

The following code example creates a new EventDescriptorCollection class using the events on button1. It requires that button1 has been instantiated on a form.

C#
EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);

Remarks

If the events parameter is empty, this constructor creates an empty EventDescriptorCollection class.

Note

The HostProtectionAttribute attribute applied to this class has the following Resources property value: Synchronization. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

See also

Applies to

.NET 10 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, 10
.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, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1