EventHandlerList 类

定义

提供一个简单的委托列表。Provides a simple list of delegates. 无法继承此类。This class cannot be inherited.

public ref class EventHandlerList sealed : IDisposable
public sealed class EventHandlerList : IDisposable
type EventHandlerList = class
    interface IDisposable
Public NotInheritable Class EventHandlerList
Implements IDisposable
继承
EventHandlerList
实现

示例

有关使用 EventHandlerList的示例,请参阅如何:使用事件属性处理多个事件For an example of using an EventHandlerList, see How to: Handle Multiple Events Using Event Properties.

注解

此类使用线性搜索算法查找委托列表中的项。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.

构造函数

EventHandlerList()

初始化 EventHandlerList 类的新实例。Initializes a new instance of the EventHandlerList class.

属性

Item[Object]

获取或设置指定对象的委托。Gets or sets the delegate for the specified object.

方法

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.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
RemoveHandler(Object, Delegate)

从列表中将委托移除。Removes a delegate from the list.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于