Freigeben über


TabletDeviceCollection.SyncRoot Eigenschaft

Definition

Ruft ein Objekt ab, das zum Synchronisieren des Zugriffs auf die Auflistung verwendet werden kann.

public:
 property System::Object ^ SyncRoot { System::Object ^ get(); };
public object SyncRoot { get; }
member this.SyncRoot : obj
Public ReadOnly Property SyncRoot As Object

Eigenschaftswert

Ein Objekt, das zum Synchronisieren des Zugriffs auf die Auflistung verwendet werden kann.

Implementiert

Beispiele

Im folgenden Beispiel wird die SyncRoot Eigenschaft veranschaulicht.

// Is the collection thread safe?        
if (!myTabletDeviceCollection.IsSynchronized)
{
    // If not, use SyncRoot to lock access
    lock (myTabletDeviceCollection.SyncRoot)
    {
        // work with collection
    }
}
'  Is the collection thread safe?
If Not myTabletDeviceCollection.IsSynchronized Then
    ' If not, use SyncRoot to lock access
    SyncLock myTabletDeviceCollection.SyncRoot
        ' work with collection
    End SyncLock
End If

Gilt für: