EventDescriptorCollection Constructor (EventDescriptor[])


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

public EventDescriptorCollection(
	EventDescriptor[] events


Type: System.ComponentModel.EventDescriptor[]

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

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.

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

EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);

.NET Framework
Available since 1.1
Return to top