EventDescriptorCollection Constructor (EventDescriptor[], Boolean)

EventDescriptorCollection Constructor (EventDescriptor[], Boolean)


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

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

public EventDescriptorCollection(
	EventDescriptor[] events,
	bool readOnly


Type: System.ComponentModel.EventDescriptor[]

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

Type: System.Boolean

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

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


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.

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 2.0
Return to top
© 2016 Microsoft