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
שתף איתנו פעולה ב- GitHub
ניתן למצוא את המקור לתוכן זה ב- GitHub, שם ניתן גם ליצור ולסקור בעיות ולמשוך בקשות. לקבלת מידע נוסף, עיין במדריך התורמים שלנו.