TabletDeviceCollection.SyncRoot Propiedad

Definición

Obtiene un objeto que se puede utilizar para sincronizar el acceso a la colección.

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

Valor de propiedad

Objeto que se puede usar para sincronizar el acceso a la colección.

Implementaciones

Ejemplos

En el ejemplo siguiente se muestra la SyncRoot propiedad .

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

Se aplica a