Freigeben über


TabletDeviceCollection.IsSynchronized Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob der Zugriff auf die Auflistung synchronisiert wird (Threadsicher).

public:
 property bool IsSynchronized { bool get(); };
public bool IsSynchronized { get; }
member this.IsSynchronized : bool
Public ReadOnly Property IsSynchronized As Boolean

Eigenschaftswert

truewenn der Zugriff auf die Sammlung synchronisiert wird (Threadsicher); andernfalls . false Der Standardwert lautet false.

Implementiert

Beispiele

Im folgenden Beispiel wird die IsSynchronized 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: