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
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기