EventHandlerList EventHandlerList EventHandlerList EventHandlerList Class


提供委派 (Delegate) 的簡單清單。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,請參閱How to:使用事件屬性處理多個事件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() EventHandlerList() EventHandlerList()

初始化 EventHandlerList 類別的新執行個體。Initializes a new instance of the EventHandlerList class.


Item[Object] Item[Object] Item[Object] Item[Object]

取得或設定指定物件的委派。Gets or sets the delegate for the specified object.


AddHandler(Object, Delegate) AddHandler(Object, Delegate) AddHandler(Object, Delegate) AddHandler(Object, Delegate)

將委派加入清單。Adds a delegate to the list.

AddHandlers(EventHandlerList) AddHandlers(EventHandlerList) AddHandlers(EventHandlerList) AddHandlers(EventHandlerList)

將委派清單加入目前清單內。Adds a list of delegates to the current list.

Dispose() Dispose() Dispose() Dispose()

處置委派清單。Disposes the delegate list.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveHandler(Object, Delegate) RemoveHandler(Object, Delegate) RemoveHandler(Object, Delegate) RemoveHandler(Object, Delegate)

將委派從清單移除。Removes a delegate from the list.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)