Class WeakEventManager.ListenerList
This class implements the most common data that a simple manager might want to store for a given source: a list of weak references to the listeners.
protected class WeakEventManager.ListenerList
- Inheritance
-
WeakEventManager.ListenerList
- Derived
Constructors
- ListenerList()
Create a new instance of ListenerList.
- ListenerList(int)
Create a new instance of ListenerList, with given capacity.
Properties
- Count
Return the number of listeners.
- Empty
An empty list of listeners.
- IsEmpty
Return true if there are no listeners.
- this[int]
Return the listener at the given index.
Methods
- Add(IWeakEventListener)
Add the given listener to the list.
- AddHandler(Delegate)
Adds the specified event handler to the specified event.
- BeginUse()
Mark the list as 'in use'. An event manager should call BeginUse() before iterating through the list to deliver an event to the listeners, and should call EndUse() when it is done. This prevents another user from modifying the list while the iteration is in progress.
- Clone()
Return a copy of the list.
- CopyTo(ListenerList)
Copies the current WeakEventManager.ListenerList to the specified WeakEventManager.ListenerList.
- DeliverEvent(object, EventArgs, Type)
Delivers the event being managed to each listener in the WeakEventManager.ListenerList.
- EndUse()
Undo the effect of BeginUse().
- PrepareForWriting(ref ListenerList)
If the given list is in use (which means an event is currently being delivered), replace it with a clone. The existing users will finish delivering the event to the original list, without interference from changes to the new list.
- Purge()
Purge the list of stale entries. Returns true if any stale entries were purged.
- Remove(IWeakEventListener)
Remove the given listener from the list.
- RemoveHandler(Delegate)
Removes the specified event handler from the specified event.