BeginUse Method
Collapse the table of content
Expand the table of content

WeakEventManager.ListenerList.BeginUse Method ()

 

Declares the list to be in use. This prevents direct changes to the list during iterations of the list items.

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public bool BeginUse()

Return Value

Type: System.Boolean

true if the list was already declared to be in use; otherwise, false.

A WeakEventManager implementation 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 caller from modifying the list while the iteration for purposes of event delivery is in progress. If the list is modified during this time, then the list is cloned. If the list is cloned, then PrepareForWriting returns true, which means that you have missed a recent listener change in the last delivery.

.NET Framework
Available since 3.0
Return to top
Show:
© 2016 Microsoft