TabletDeviceCollection.SyncRoot Eigenschap

Definitie

Hiermee haalt u een object op dat kan worden gebruikt om de toegang tot de verzameling te synchroniseren.

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

Waarde van eigenschap

Een object dat kan worden gebruikt om de toegang tot de verzameling te synchroniseren.

Implementeringen

Voorbeelden

In het volgende voorbeeld ziet u de SyncRoot eigenschap.

// 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

Van toepassing op