BaseCollection.IsSynchronized BaseCollection.IsSynchronized BaseCollection.IsSynchronized BaseCollection.IsSynchronized Property

定义

获取一个值,该值指示对 ICollection 的访问是否同步。Gets a value indicating whether access to the ICollection is synchronized.

public:
 property bool IsSynchronized { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool IsSynchronized { get; }
member this.IsSynchronized : bool
Public ReadOnly Property IsSynchronized As Boolean

属性值

此属性始终返回 falseThis property always returns false.

实现

注解

如果集合是线程安全的, 则IsSynchronized属性返回true, 程序员无需执行任何操作来保证回收线程的安全。If a collection is thread safe, the IsSynchronized property returns true, and the programmer does not have to do anything to keep the collection thread safe.

如果BaseCollectionlock相同, 则IsSynchronized false属性返回, 然后C# 属性返回可与关键字一起使用的SyncRoot对象。If, as is the case with the BaseCollection, the IsSynchronized property returns false, then the SyncRoot property returns an object that can be used with the C# lock keyword. 使用Monitor类的Enter静态Exit方法和方法, 手动锁定和解锁同步对象。Use the static Enter and Exit methods of the Monitor class to manually lock and unlock the synchronization object.

适用于