Bewerken

Delen via


TabletDeviceCollection.IsSynchronized Property

Definition

Gets a value that indicates whether access to the collection is synchronized (thread safe).

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

Property Value

true if access to the collection is synchronized (thread safe); otherwise, false. The default is false.

Implements

Examples

The following example demonstrates the IsSynchronized property.

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

Applies to