ActivityCollection.ICollection.SyncRoot Property
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.
Gets an object that can be used to synchronize access to the ICollection<T>.
property System::Object ^ System::Collections::ICollection::SyncRoot { System::Object ^ get(); };
object System.Collections.ICollection.SyncRoot { get; }
member this.System.Collections.ICollection.SyncRoot : obj
ReadOnly Property SyncRoot As Object Implements ICollection.SyncRoot
Property Value
An object that can be used to synchronize access to the ICollection<T>.
Implements
Remarks
For collections whose underlying store is not publicly available, the expected implementation is to return the current instance. Note that the pointer to the current instance might not be sufficient for collections that wrap other collections; those should return the underlying collection SyncRoot property.
Most collection classes in the System.Collections namespace also implement a Synchronized
method, which provides a synchronized wrapper around the underlying collection. However, derived classes can provide their own synchronized version of the collection using the ICollection.SyncRoot property. The synchronizing code must perform operations on the ICollection.SyncRoot property of the collection, not directly on the collection. This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the collection instance.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기