TabletDeviceCollection.SyncRoot Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets an object that can be used to synchronize access to the collection.
public:
property System::Object ^ SyncRoot { System::Object ^ get(); };
public object SyncRoot { get; }
member this.SyncRoot : obj
Public ReadOnly Property SyncRoot As Object
Property Value
An object that can be used to synchronize access to the collection.
Implements
Examples
The following example demonstrates the SyncRoot 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
Dolgozzon együtt velünk a GitHubon
A tartalom forrása a GitHubon található, ahol létrehozhat és áttekinthet problémákat és lekéréses kérelmeket is. További információért tekintse meg a közreműködői útmutatónkat.