TabletDeviceCollection.SyncRoot Eigenschaft

Definition

Ruft ein Objekt ab, mit dem der Zugriff auf die Auflistung synchronisiert 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

Object

Ein Objekt, mit dem der Zugriff auf die Auflistung synchronisiert 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: