EventHandlerList Class

Definition

Provides a simple list of delegates. This class cannot be inherited.

C#
public sealed class EventHandlerList : IDisposable
Inheritance
EventHandlerList
Implements

Examples

For an example of using an EventHandlerList, see How to: Handle Multiple Events Using Event Properties.

Remarks

This class uses a linear search algorithm to find entries in the list of delegates. A linear search algorithm is inefficient when working with a large number of entries. Therefore, when you have a large list, finding entries is slow.

Constructors

EventHandlerList()

Initializes a new instance of the EventHandlerList class.

Properties

Item[Object]

Gets or sets the delegate for the specified object.

Methods

AddHandler(Object, Delegate)

Adds a delegate to the list.

AddHandlers(EventHandlerList)

Adds a list of delegates to the current list.

Dispose()

Disposes the delegate list.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveHandler(Object, Delegate)

Removes a delegate from the list.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

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