IsSynchronized Property
- Explicit
- Implements
System.explicitly: cast to the interface to use it.Collections. ICollection
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Returns true if the collection is designed to be thread safe, otherwise, it returns false.
Syntax
The type implements this member of System.Collections.ICollection explicitly: code reaches it by casting to the interface, as in ((ICollection)value).IsSynchronized.
bool ICollection.IsSynchronized { get; }Private ReadOnly Property IsSynchronized As Boolean Implements ICollection.IsSynchronizedExamples
The following example checks the collection's synchronization contract before sharing a snapshot with another thread.
ICollection collection = textControl.TrackedChanges;
if (!collection.IsSynchronized)
{
lock (collection.SyncRoot)
{
Console.WriteLine($"Tracked changes: {collection.Count}");
}
}Dim collection As ICollection = textControl.TrackedChanges
If Not collection.IsSynchronized Then
SyncLock collection.SyncRoot
Console.WriteLine($"Tracked changes: {collection.Count}")
End SyncLock
End IfLimitations
Read only.