List<T>.ICollection.IsSynchronized プロパティ
定義
ICollection へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。Gets a value indicating whether access to the ICollection is synchronized (thread safe).
property bool System::Collections::ICollection::IsSynchronized { bool get(); };
bool System.Collections.ICollection.IsSynchronized { get; }
ReadOnly Property IsSynchronized As Boolean Implements ICollection.IsSynchronized
プロパティ値
true
へのアクセスが同期されている (スレッド セーフである) 場合は ICollection。それ以外の場合は false
。true
if access to the ICollection is synchronized (thread safe); otherwise, false
. List<T> の既定の実装では、このプロパティは常に false
を返します。In the default implementation of List<T>, this property always returns false
.
実装
注釈
System.Collections.Generic 名前空間のコレクションの既定の実装は同期されません。Default implementations of collections in the System.Collections.Generic namespace are not synchronized.
コレクションの列挙処理は、本質的にスレッドセーフな処理ではありません。Enumerating through a collection is intrinsically not a thread-safe procedure. 列挙が書き込みアクセスによって競合するまれなケースとして、列挙全体の間にコレクションをロックできます。In the rare case where enumeration contends with write accesses, you can lock the collection during the entire enumeration. コレクションに対し複数のスレッドがアクセスして読み取りや書き込みを行うことができるようにするには、独自に同期化を実装する必要があります。To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
SyncRoot は、ICollectionへのアクセスを同期するために使用できるオブジェクトを返します。SyncRoot returns an object that can be used to synchronize access to the ICollection. 同期は、コレクションにアクセスする前にすべてのスレッドがこのオブジェクトをロックする場合にのみ有効です。Synchronization is effective only if all threads lock this object before accessing the collection.
このプロパティ値を取得することは、O(1) 操作になります。Retrieving the value of this property is an O(1) operation.