When implemented by a class, retrieves an object that can be used to synchronize access to the ICollection.
[Visual Basic] ReadOnly Property SyncRoot As Object [C#] object SyncRoot {get;} [C++] Object* get_SyncRoot() = 0; [JScript] abstract function get SyncRoot() : Object;
An object that can be used to synchronize access to the ICollection.
Collection classes in System.Collections also implement a GetSynchronized method, which provides a synchronized wrapper around the underlying collection.
For collections whose underlying store is not publicly available, the expected implementation is to simply return 'this'. Note that the 'this' pointer may not be sufficient for collections that wrap other collections; those should return the underlying collection's SyncRoot property.
In the absence of a GetSynchronized() method on a collection, the expected usage for SyncRoot would look like this:
ICollection col = ... synchronized (col->SyncRoot) { // Some operation on the collection, which is now thread safe. }
ICollection Interface | ICollection Members | System.Collections Namespace | IsSynchronized