WeakEventManager.ListenerList.PrepareForWriting Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Checks to see whether the provided list is in use, and if so, sets the list reference parameter to a copy of that list rather than the original.
public:
static bool PrepareForWriting(System::Windows::WeakEventManager::ListenerList ^ % list);
public static bool PrepareForWriting (ref System.Windows.WeakEventManager.ListenerList list);
static member PrepareForWriting : ListenerList -> bool
Public Shared Function PrepareForWriting (ByRef list As WeakEventManager.ListenerList) As Boolean
Parameters
The list to check for use state and potentially copy.
Returns
true
if the provided list was in use at the time of call and therefore the list
parameter reference was reset to be a copy. false
if the provided list was not in use, in which case the list
parameter reference remains unaltered.
Remarks
If the given list is in use (which means an event is currently being delivered), calling this method will replace the input list
with a clone. The existing users will finish delivering the event to the original list, without interference from changes to the new list.
If the method returns true
, callers may want to insert the new list in their own data structures, since this indicates the possibility that the provided list is no longer current.
This method calls BeginUse internally and then immediately calls EndUse. Therefore calling PrepareForWriting does not itself introduce a lock on the list. Even the clone copy is done as a secondary operation after calling EndUse.
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om